Write a program that calculates the amount of maoney earned on an investment, that amount should include 12 percent interest. prompt the user to choose the investment amount form one menu and the number of years for the investment in the second menu. display the total amount(balance)for each year of the investment. use a loop instructionto calculate the balance for each year. use the fourmula amount = investment * (1 + interest)raised to a power equalt to the year to caluclate the balance. Use the math power fucntion Math.pow(x,y) where x = (1 + interest) and y is for the year.
Who can fix this the correct way!!!
import javax.swing.*;
//Sample Program to enter
String, Integer, and Float Numbers
public class Investment
{
public static void main(String[] args)
{
String gradePointAverage = JOptionPane.showInputDialog("How much money are you going to invest?");
float investment = Float.parseFloat(gradePointAverage);
String admissionScor = JOptionPane.showInputDialog("How many year are you interested in? (1-30)");
int years = Integer.parseInt(admissionScor);
double amount,amount1, x;
int y;
x = (1 + 0.12);
y = years;
amount = investment * (1 + 0.12);
amount1 = Math.pow(x,y) * investment;
for(y = years; y < 0; --y)
//if(amount1 > 0)
//amount1 += 1;
{
System.out.println( "For year number " + y + " The total will be " + amount1);
}
System.exit(0);
}
}