Hi all,
Me again. I am having issues with a looping program. My current issue right now is that it wont compile, it keeps saying i need another perentheses at line 20. This program is suppose to calculate the investment and show for every year. The year and amount of investment is input by the user. So if the user puts in 8 years, it would show for year 1, 2, 3 and so on. I know this program probably needs work, it was quickly put together so any hints or explinations on this would be great. Here is my code:
import javax.swing.JOptionPane;
public class Investment
{
public static void main(String[] args)
{
String inputInvest;
String yearsInvest;
double rate = 0.8;
double investment;
int years;
int yearsloop = 1;
double balance;
{
inputInvest = JOptionPane.showInputDialog(null,
"What is the amount of the investment?");
yearsInvest = JOptionPane.showInputDialog(null,
"How many years will this investment be?");
investment = Double.parseDouble(inputInvest);
years = Integer.parseInteger(yearsInvest);
while(yearsloop !> years)
{
balance = investment * return;
yearsloop = JOption.showConfirmDialog(null,
"After " + yearsloop + "at a 8% return" +
"your balance is " + balance + "Do you" +
"want to see your balance after another year?");
yearsloop = yearloop + 1;
}
System.exit(0);
}
}
}
Thanks much,
Sam