import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class ShowScore extends Applet implements ActionListener
{

     private Button increase, decrease;
     private ScoreKeeper theScore;

     public void init()
     {
       increase = new Button("Increase");
       add(increase);
       increase.addActionListener(this);

       decrease = new Button("Decrease");
       add(decrease);
       decrease.addActionListener(this);

       theScore = new ScoreKeeper(0);
     }

     public void actionPerformed(ActionEvent event)
     {
       if (event.getSource() == increase)
            theScore.addValue(1);

       if (event.getSource() == decrease)
            theScore.lessValue(1);

       repaint();
     }

     public void paint(Graphics g)
     {
       theScore.display(g);
     }
 }

 class ScoreKeeper
 {
    private static int score;

    public ScoreKeeper(int x)
    {
      score = x;
    }

    public void addValue(int add)
    {
       score = score + add;
    }

    public void lessValue(int less)
    {
      score = score - less;
    }

    public void display(Graphics g)
    {
      g.drawString(" The current score is "+score, 40,50);
    }
}
