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);
rayan22
0
Newbie Poster
Recommended Answers
Jump to PostOk. And just what is your problem? You want us to analyze your code making untenable assumptions? Please get real...
All 2 Replies
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
stultuske
1,116
Posting Maven
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.