public static void main(String[] args)
//Enter savings amount
String savingsAmountString = JOptionPane.showInputDialog(
" Enter savings amount");
//Convert string to double
double savingsAmount = Double.parseDouble(savingsAmountString);

//enter interest
String interestRateString = JOptionPane.showInputDialog(
"Enter annual interest rate ");
//Convert String to double
double annualInterestRate = Double.parseDouble(interestRateString);

//Enter number of months
String numberOfMonthsString = JOptionPane.showInputDialog(
"Enter number of months");
//Convert string to double
double numberofMonths = Double.parseDouble(numberOfMonthsString);

//obtain monthly interest rate

double newBalance = savingsAmount * Math.pow((1+annualInterestRate/12),(numberofMonths*12)-1)/annualInterestRate);

String output = "after monts the result is" + newBalance;

JOptionPane.showConfirmDialog(null, output); 
3 Years
Discussion Span
Last Post by stultuske

Ok. And just what is your problem? You want us to analyze your code making untenable assumptions? Please get real...


that isn't even the entire main method.
it's impossible for us to make anything out of this, let alone know what you are looking for.
but, anyway, you have a ')' too much in your

double newBalance = savingsAmount * Math.pow((1+annualInterestRate/12),(numberofMonths*12)-1)/annualInterestRate);

no doubt your compiler already told you this.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.