import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;

public class Grade extends Applet implements AdjustmentListener
{
    private Scrollbar slider;
    private int score;

    public void init()
    {
        slider = new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,101);
        add(slider);
        slider.addAdjustmentListener(this);
    }

    public void paint(Graphics g)
    {
     if (score>89&&score<101)
       {
        g.drawString("Great....you have passed with flying colors!",50,50);
        g.drawString("You got an A",50,90);
       }

     if (score>84&&score<90)
       {
        g.drawString("Congratulations and well done!",50,50);
        g.drawString("You got a BA",50,90);
       }

     if (score>79&&score<85)
       {
        g.drawString("Good , but you can still improve!",50,50);
        g.drawString("You got a B",50,90);
       }

     if (score>74&&score<80)
       {
        g.drawString("You passed ! try harder next time.",50,50);
        g.drawString("You got a CB",50,90);
       }

     if (score>69&&score<75)
       {
        g.drawString("You made it.Double your efforts next time.",50,50);
        g.drawString("You got a C",50,90);
       }

     if (score<70)
       {
        g.drawString("Sorry, you failed. But don't give up.",50,50);
        g.drawString("You got an E , a D or maybe CD",50,90);
       }
     g.drawString(" Your mark is "+score,50,70);
    }

    public void adjustmentValueChanged(AdjustmentEvent e)
    {
        score = slider.getValue();
        repaint();
    }
}





