Question
A term deposit is a money deposit at a banking institution that cannot be withdrawn for a period of time. Generally speaking, the longer the
A term deposit is a money deposit at a banking institution that cannot be withdrawn for a period of time. Generally speaking, the longer the term the better the yield on the money. The following table shows some term deposit plans offered by a local bank
Term Interest Rate 4 months 3.50% p.a. 7 months 3.65% p.a. 12 months 3.75% p.a.
The plans are offered with following conditions: A. Minimum investment $1,000 and maximum investment $500,000 inclusive. B. Interest is paid at maturity (at the end of the term). C. 4, 7, and 12 months are considered standard terms. However, customers can choose a nonstandard term, where the largest standard term being covered will apply (at most once). In the rest of time the deposit (plus the interest earned from the completed Term Deposit) will transfer to a Savings account with interest rate of 1.90% p.a. only.
Write a function called interestEstimator that takes deposit and term, calculates and returns the interest that the customer will receive. The function takes two arguments: deposit and term. deposit is a Number value for the amount put in investment. If deposit is less then the minimum investment or greater than the maximum investment, an error message should be alerted and the function should return zero as the calculated interest. term is also a Number value indicating the number of months that deposit is put in investment. The interest should then be calculated for deposit using a rate corresponding to term, taking aforementioned Condition B and C into consideration. If term is not supplied or not a Number value, the minimum standard term (4 months) should apply. The calculated interest needs to be precise at cents (two digits after decimal point, with the third digit rounded up for 0.005). The function should return a Number value and have only a single exit point (return statement). Appropriately indent the code and add necessary curly braces for professional style.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started