import java.awt.*;
import javax.swing.JOptionPane;
import java.applet.Applet;
/*<applet code="Interest" width=200 height=100>
<param name=rate value=monthly>
</applet>*/
public class Interest extends Applet
{
String rate;
public void start()
{
String s=JOptionPane.showInputDialog("enter principal amount");
int p=Integer.parseInt(s);
s=JOptionPane.showInputDialog("enter rate");
int r=Integer.parseInt(s);
s=JOptionPane.showInputDialog("enter time");
int t=Integer.parseInt(s);
rate=getParameter("rate");
if(rate.equals("monthly"))
{
double amount=(p*t*r)/(100*12);
JOptionPane.showMessageDialog(null,"simple interest="+amount,"simple interst",JOptionPane.INFORMATION_MESSAGE);
}
else
{
double amount=(p*t*r)/(100);
JOptionPane.showMessageDialog(null,"simple interest="+amount,"simple interst",JOptionPane.INFORMATION_MESSAGE);
}
}
}
No comments:
Post a Comment