JAVA CODE

// Result2 program
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;

public class Result2 extends Applet
             implements ActionListener
{
  Label Prompt;
  TextField ScoreText;
  int Score;

  public void init()
  {
    Prompt = new Label ("Enter score ");
    add(Prompt);

    ScoreText = new TextField(3);
    add(ScoreText);
    ScoreText.addActionListener(this);
  }
  public void paint( Graphics g )
  {
    if (Score>100)
       g.drawString(" The score cannot over 100", 10, 50 );
    else if (Score>=90)
       g.drawString(" A ", 10, 50 );
    else if (Score>=80)
       g.drawString(" B ", 10, 50 );
    else if (Score>=70)
       g.drawString(" C ", 10, 50 );
    else if (Score>=60)
       g.drawString(" D ", 10, 50 );
    else if (Score>=0)
       g.drawString(" F ", 10, 50 );
    else
       g.drawString(" Error ",10, 50 );
   }

   public void actionPerformed ( ActionEvent e )
   {
     Score = Integer.valueOf(ScoreText.getText()).intValue();
     repaint();
   }
}