If interest is compounded annually, it grows as follows. Suppose P0 is the initi
ID: 3626687 • Letter: I
Question
If interest is compounded annually, it grows as follows. Suppose P0 is the initial amount and INT is the rate per year. If P1, P2, and P3 is the balance at the end of first, second, and third year, respectivey, then
P1 = P0 + P0 * INT = P0 * (1 + INT)
P2 = P1 + P1 * INT = P1 * (1 + INT) = P0*(1 + INT) * (1 + INT)
= P0 * (1 + INT)^2
P3 = P2 + P2 * INT = P2 * (1 + INT) + P0 * (1 + INT) * (1 * INT) * (1 + INT) = P0 * (1 + INT)^3
and so on.
When money is deposited in an IRA account it is usually sheltered from taxes until the money is withdrawn after the age of 59. Suppose that someone dear to you opened such and account for you on your sixteenth birthday at 10% interest and that he or she forgot about it (so no money was added or withdrawn). On your sixtieth birthday, you are notified about this account by some fortune hunters. The money has been compounded at the 10% rate. Write a program that reads an initial amount and computes the total in the account on your sixtieth birthday.
You decide to leave the money in for another year. Starting from your sixty-first birthday, you decide to withdraw each year's interest income. In other words, you withdraw the interest and leave the rest of the money untouched . How much income per month for the rest of your life would you have?
Design your program to accept any integer input. Test it with initial investments of: $1700, $3600, and $8500.
(Note: Use a loop to compute the amount at your sixtieth birthday. Do not use the predefined function pow .)
The program should do all the computing needed, and ouput all the relevant data as follows:
The initial investment was $______. The total amount accumulated after ______ years, if $______ is allowed to compound with an interest of 10.00%, comes to $_______.
The total amount accumulated after ______ (years + 1) years, if $ _________ is allowed to compound with an interest of 10%, comes to $ _______.
The interest earned during the year is $ ______. If interest is withdrawn each year thereafter, my income is $ _______ per month.
Explanation / Answer
import java.io.*; public class interest { public static void main(String[] args) throws IOException { String line; BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the initial Investment without a dollar sign : "); line = reader.readLine(); double initialInvestment = Double.parseDouble(line); System.out.println("Enter the interest rate in percent but without the percent sign, e.g. for 5% enter just 5 : "); line = reader.readLine(); double percent = Double.parseDouble(line); System.out.println("Enter the number of compounding periods e.g. number of years for annual compounding "); line = reader.readLine(); int periods = Integer.parseInt(line); double Investment = initialInvestment; for(int i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.