Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are a new graduate of the University and you just landed your first job earn

ID: 667588 • Letter: Y

Question

You are a new graduate of the University and you just landed your first job earning about $60K/year. You vaguely recall one of your professors saying, 'You should start investing with your first pay check.' He said something like, “10% or $500.00 a month for 40 years and you would be a millionaire.”

Use the Problem Solving Process to develop a Java Application that you will use to calculate the compounding-interest with a for loop.   You will use an interest rate of 6% (.06) and start with a principal investment of $2000.00 (That is what’s left from graduation gifts after putting money down on a new car). You will run your code for 40 years and output annual totals.

Your compounding interest equation should look something like:

Principal = (Principal + (Monthly * 12)) * IntRate

Please re-write your application so that you can change the interest rate, allow for a different initial principal investment, and output the total amounts invested verses the total amount earned.

Write all the above using Java

Explanation / Answer

This is the below Program :

import java.util.Scanner;

public class CompoundInterest {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);

double principal = 0;
double rate = 0;
double time = 0;


double compoundInterest = 0;

System.out.print("Enter the Principal amount : ");
principal = input.nextDouble();

System.out.print("Enter the Rate : ");
rate = input.nextDouble();

System.out.print("Enter the Time : ");
time = input.nextDouble();

for(int x = 1; x <= time; x++) {
double amount = principal * Math.pow(1+ rate, x);
System.out.printf("Year " + x + ": %.2f " , amount);

}

}

}