Welcome to DIC! Please use code tags the next time you post, include your question in your post, mention any errors you have, so we can help you.
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.
Please post like this:

Thank you for helping us helping you.
java
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class InterestCalcApplet extends Applet implements ActionListener {
TextField principalField, rateField, numYearsField;
double simpleInterest = 0;
double amount = 0;
double principal = 0;
double numYears = 0;
double rate = 0;
public void init()
{
principalField = new TextField (6);
rateField = new TextField (6);
numYearsField = new TextField (6);
Label principalLabel = new Label ("Principal ");
Label rateLabel = new Label ("Rate (%) ");
Label numYearsLabel = new Label ("Time (in years) ");
Button calcButton = new Button ("Calculate");
add (principalLabel);
add (principalField);
add (rateLabel);
add (rateField);
add (numYearsLabel);
add (numYearsField);
add (calcButton);
calcButton.addActionListener (this);
}
public void actionPerformed (ActionEvent e)
{
String principalString = principalField.getText ();
principalString = principalString.trim ();
Double principalDouble = new Double (principalString);
principal = principalDouble.doubleValue ();
String numYearsString = numYearsField.getText ();
numYearsString = numYearsString.trim ();
Double numYearsDouble = new Double (numYearsString);
numYears = numYearsDouble.doubleValue ();
rate = new Double (rateField.getText().trim()).doubleValue();
simpleInterest = (principal * rate * numYears) / 100;
amount = principal + simpleInterest;
repaint();
}
public void paint (Graphics g)
{
g.drawString ("The simple interest and amount after " + numYears + " years", 60,100);
g.drawString (" Simple Interest: " + simpleInterest, 60,120);
g.drawString (" Total amount: " + amount, 60,140);
}
}