import java.applet.*; import java.awt.*; public class Add extends Applet { public void init() { setBackground(Color.yellow); setForeground(Color.black); } public void paint(Graphics g) { int x=0; int y=0; int answer=0; float divide_answer=0; int operation=0; String paramText; paramText = getParameter("num1"); x = Integer.parseInt(paramText); // this converts our parameter string to an int paramText = getParameter("num2"); y = Integer.parseInt(paramText); paramText = getParameter("operation"); operation = Integer.parseInt(paramText); if (operation == 1) { // use curly brackets // to have more than one // in your if statement answer = x + y; g.drawString("Your answer = " + answer, 20, 20); } else if (operation == 2) { answer = x - y; g.drawString("Your answer = " + answer, 20,20); } else if (operation == 3) { answer = x * y; g.drawString("Your answer = " + answer, 20, 20); } else if (operation == 4) { divide_answer = x / y; g.drawString("Your answer = " + divide_answer, 20, 20); } else g.drawString("Invalid operation", 20, 20); } }