Question: Assignment #2 Due date: 12:00 pm, 9/11/2017 Problem Description A monthly statement of a saving account usually includes the interest income and the ending balance
Assignment #2
Due date: 12:00 pm, 9/11/2017
Problem Description
A monthly statement of a saving account usually includes the interest income and the ending balance of the account at the end of each month. Given the balance of an account at the end of a month, the interest income of the account can be calculated using the formula below:
Interest income = Account balance * Monthly interest rate (1)
The ending balance or the compound value of the account is computed using the formula below:
Ending balance = Account value + Interest income (2)
Combining the formula (1) and formula (2), the compound value of the account at the end of the first month can be calculated as:
Ending balance = Account value + (Account balance * Monthly interest rate)
Using a simple algebra rule, the above formula can be simplified as
1st Month ending balance = Account value * (1 + Monthly interest rate) (3)
If the customer of the account adds additional saving to the account each month, the account value should be the sum of the balance from the previous month and the saving added in the current month. Thus, the compound value of the account at the end of month 1 and forward is calculated by the following formula:
Ending balance = (Monthly saving + Previous months account value) * (1 + Monthly interest rate) (4)
Suppose you save $100 each month into a savings account with the annual interest rate 5%. Thus, the monthly interest rate is the annual interest rate divided by the number of months in a year, that is, 0.05/12 = 0.00417.
After the first month, the value in the account using the formula (3) becomes
100 * (1 + 0.00417) = 100.417
After the second month, the value in the account using formula (4) becomes
(100 + 100.417) * (1 + 0.00417) = 201.252
After the third month, the value in the account becomes
(100 + 201.252) * (1 + 0.00417) = 302.507
and so on.
This problem is to calculate the compound value of a saving account. Write a program that
Prompts the user to enter a monthly saving amount and the annual interest rate
Calculates and displays the compound value of the saving account after the 6th month.
Assignment Requirements
Use the exercise to practice the following problem solving steps:
Design a solution to the problem and identify the required process steps
Create a Java class to implement the solution and choose a proper class name
Write the solution pseudo-code as Java comments in the program
Use the pseudo-code comments as the guide and write Java code to implement the solution
Correct all syntax errors in the program
Run the program to correct all logical errors until it produces right answers
Perform the following three test runs:
|
| Saving Amount | Annual Interest Rate | Compound Value after 6th Month |
| Test run 1 | 100 | 5.0 | 608.81 |
| Test run 2 | 150 | 5.0 | 913.22 |
| Test run 3 | 100 | 5.5 | 609.70 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
