- #1
bomba923
- 763
- 0
Why won't this work?
----------------------------------------
import javax.swing.JOptionPane ;
public class FinalBalanceCalculator {
public static void main(String args[]) {
String input;
String name;
double b0;
double rc;
double ty;
double ans;
input = JOptionPane.showInputDialog("What is your name?") ;
name = input ;
input = JOptionPane.showInputDialog("What is your interest rate?") ;
rc = Double.parseDouble(input);
input = JOptionPane.showInputDialog("What is your initial balance?" );
ty = Double.parseDouble(input) ;
ans = Math.pow(1 + rc,ty) * b0 ;
System.out.PrintIn(name + "has an initial balance of $" + b0 + ",") ;
System.out.PrintIn("which is compounded annually at " + rc + "%") ;
System.out.PrintIn("After " + ty + " years, " + name + " will have exactly:") ;
System.out.PrintIn("$" + ans ) ;
}//main
}//FinalBalanceCalculator
----------------------------------------
import javax.swing.JOptionPane ;
public class FinalBalanceCalculator {
public static void main(String args[]) {
String input;
String name;
double b0;
double rc;
double ty;
double ans;
input = JOptionPane.showInputDialog("What is your name?") ;
name = input ;
input = JOptionPane.showInputDialog("What is your interest rate?") ;
rc = Double.parseDouble(input);
input = JOptionPane.showInputDialog("What is your initial balance?" );
ty = Double.parseDouble(input) ;
ans = Math.pow(1 + rc,ty) * b0 ;
System.out.PrintIn(name + "has an initial balance of $" + b0 + ",") ;
System.out.PrintIn("which is compounded annually at " + rc + "%") ;
System.out.PrintIn("After " + ty + " years, " + name + " will have exactly:") ;
System.out.PrintIn("$" + ans ) ;
}//main
}//FinalBalanceCalculator
Last edited: