JAVA CODE

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

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

  public void init()
  {
    Prompt = new Label ("Enter your score (0--100) ");
    add(Prompt);

    ScoreText = new TextField(3);
    add(ScoreText);
    ScoreText.addActionListener(this);
  }
  public void paint( Graphics g )
  {
    switch ( Score / 10 )
     {
      case 10:
         if (Score>100)
             g.drawString(" The score cannot over 100", 10, 50 );
         else
             g.drawString(" A ", 10, 50);
         break;
      case 9:
         g.drawString(" A ", 10, 50 );
         break;
      case 8:
         g.drawString(" B ", 10, 50 );
         break;
      case 7:
         g.drawString(" C ", 10, 50 );
         break;
      case 6:
         g.drawString(" D ", 10, 50 );
         break;
      case 5:
      case 4:
      case 3:
      case 2:
      case 1:
      case 0:
         if (Score>=0)
            g.drawString(" F ", 10 ,50 );
         break;
      default:
            g.drawString(" Invalid Score ", 10, 50 );
         break;
      }
     
   }

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