//Applet ButtonIn.java //Prepared by (your name) on (current data) at (WELTEC) import java.awt.*; import java.applet.*; public class ButtonIn extends Applet { private int dig; //This variable represents the calculator key just clicked on private int total; //This variable shows what appears on the calculator's screen public void start()//This method sets the initial displays { total=0; //This sets the initial screen display before keys are pressed digit_in(dig); } public void digit_in(int digit_clicked) //This method accepts the most recent click { dig = digit_clicked; total = total*10 + dig; repaint(); } public void paint(Graphics g) //This method displays what appears on the screem { g.setFont(new Font("TimesRoman",Font.BOLD+Font.ITALIC,48)); g.setColor(Color.red); g.drawString("Digit pressed = " + dig, 40, 80); g.drawString("Total = " + total, 40, 140); } }