/    Sign up×
Community /Pin to ProfileBookmark

Please urgent attention

First, create an array of objects called data with the following values:

  • 1.

    Principal- 2500, time- 1.8

  • 2.

    Principal- 1000, time- 5

  • 3.

    Principal- 3000, time- 1

  • 4.

    Principal- 2000, time- 3

  • NB: Each individual object should have ‘principal’ and ‘time’ as keys.

    Write a function called “interestCalculator” that takes an array as a single argument and does the following:

    Determine the rate applicable using the conditions:

  • *

    If the principal is greater than or equal to 2500 and the time is greater than 1 and less than 3, then rate = 3

  • *

    If the principal is greater than or equal to 2500 and the time is greater than or equal to 3, then rate = 4

  • *

    If the principal is less than 2500 or the time is less than or equal to 1, then rate = 2

  • *

    Otherwise, rate = 1;

  • Calculate the interest for each individual object using the formula: (principal * rate * time) / 100.

    The function should return an array of objects called ‘interestData’ and each individual object should have ‘principal’, ‘rate’, ‘time’ and ‘interest’ as keys with their corresponding values.

    Log the ‘interestData’ array to console BEFORE your return statement.

    Finally, call/execute the function and pass the ‘data’ array you created.

    to post a comment
    JavaScript

    5 Comments(s)

    Copy linkTweet thisAlerts:
    @NachfolgerApr 02.2020 — @samcesa45#1616862

    The purpose of this website is not for us to do your homework. I'll get you started but I'm not going to finish your project for you.

    Step 1:
    ``<i>
    </i>let data = [{principal: 2500, time: 1.8}, {principal: 1000, time: 5}, {principal: 3000, time: 1}, {principal: 2000, time: 3}];<i>
    </i>
    `</CODE>

    Step 2:
    <CODE>
    `<i>
    </i>function interestCalculator(a) {
    ...
    }<i>
    </i>
    ``


    If you have specific questions, feel free to ask.
    Copy linkTweet thisAlerts:
    @samcesa45authorApr 02.2020 — @Nachfolger#1616866 ok thanks
    Copy linkTweet thisAlerts:
    @samcesa45authorApr 02.2020 — @Nachfolger#1616866 Got stucked at some point.....But have successfully finished it...thanks
    Copy linkTweet thisAlerts:
    @damyApr 03.2020 — @samcesa45#1616894

    please how were you able to solve it

    I need your guidance
    Copy linkTweet thisAlerts:
    @DanielwonderApr 07.2020 — @sa007 mcesa45#1616894 pls can help me with the answer of the algorithm question you asked. Please!
    ×

    Success!

    Help @samcesa45 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.1,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...