Question
Your client needs a program that enables her to calculate the ending balance of a series of equal monthly deposits plus interest. Your program will
Your client needs a program that enables her to calculate the ending balance of a series of equal monthly deposits plus interest. Your program will prompt the user to enter the number of months over which deposits will be made, a deposit amount and an annual interest, which must be converted to monthly rate. For instance, 3% as an annual rate becomes 0.03 / 12 or 0.0025 as a decimal value. We assume that deposits are made at the beginning of a month; thus each deposit will earn a full month of interest.
If the user enters the following values: 12 for the number of months, $500 for the periodic deposit and 3% for the annual interest rate, the amount deposited in month 1 (I say month 1 because this process doesnt need to follow a calendar year), will receive 12 months of interest at a monthly rate of 0.0025, then amount deposited in month 2 will receive 11 months of interest at this rate, and so on until the amount deposited in month 12 receives 1 month of interest at this rate. Heres demonstration of this calculation:
Periodic deposit 500
Annual interest rate 3.00%
Monthly interest rate 0.0025
Formula for calculating ending balance :
deposit*(1 + monthly interest rate)^number of months (^ indicates exponentiation)
Deposit Number 1 + (1 + monthly Times of months monthly interest Deposit of Interest interest rate)^number Accrued rate of months Month 1 500 12 1.0025 1.030416 515.2080 Month 2 500 11 1.0025 1.027846 513.9230 Month 3 500 10 1.0025 1.025283 512.6415 Month 4 500 9 1.0025 1.022726 511.3630 Month 5 500 8 1.0025 1.020176 510.0880 Month 6 500 7 1.0025 1.017632 508.8160 Month 7 500 6 1.0025 1.015094 507.5470 Month 8 500 5 1.0025 1.012563 506.2815 Month 9 500 4 1.0025 1.010038 505.0190 Month 10 500 3 1.0025 1.007519 503.7595 Month 11 500 2 1.0025 1.005006 502.5030 Month 12 500 1 1.0025 1.002500 501.2500
Sum of deposits 6000
End-of-Year total 6098.4
Even if youre mathematically clever enough to derive a formula that can perform this calculation in one statement, use a loop to solve this problem.
Your program should display a table like the one above plus the sum of deposits and the end-of-year total.
This is being don in Java.
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