import java.text.NumberFormat;
import java.util.Locale;
import javax.swing.swing.JOptionPane;
import javax.swing.JTextArea;
public class Interest {
public static void main ( String args[])
{
double amount, principal = 1000.0, rate = 0.05;
NumberFormat moneyFormat =
NumberFormat getCurrencyInstance ( Locale.US );
JTextArea outputTextArea = new JTextArea ();
outputTextArea.setText ( " Year\tAmount on deposit\n" );
for ( int year = 1; year <= 10; year++){
amount = principal * Math.pow( 1.0 + rate, year );
outputTextArea.append( year + "\t" +
moneyFormat.format ( amount)+ "\n");
}
JoptionPane.showMessageDialog ( null, outputTextArea,
"Comput Interest", JOptionPane.INFORMATION_MESSAGE );
System.exit (0);
}
}
Exception in thread "main" java.lang.NoClassDefFoundError: Interest
Press any key to continue...
2006-07-21
04:18:59
·
4 respostas
·
perguntado por
Igor LPS
2
em
Programação e Design