<% String message = request.getParameter("message"), good = request.getParameter("good"), total = request.getParameter("total"), n1 = request.getParameter("n1"), n2 = request.getParameter("n2"), // state is above answer = request.getParameter("answer"); // input if (message == null) { good = "0"; total = "0"; n1 = "" + (int) ((Math.random() * 100) - 50); n2 = "" + (int) ((Math.random() * 100) - 50); message = "(" + good + "/" + total + ") What is " + n1 + " + " + n2 + "? Type your answer here: "; } else { int a = Integer.parseInt(n1) + Integer.parseInt(n2); if (a == Integer.parseInt(answer)) { good = "" + (Integer.parseInt(good) + 1); } total = "" + (Integer.parseInt(total) + 1); n1 = "" + (int) ((Math.random() * 100) - 50); n2 = "" + (int) ((Math.random() * 100) - 50); message = "(" + good + "/" + total + ") What is " + n1 + " + " + n2 + "? Type your answer here: "; } %> Lab 04/13 Servlet
<%=message%>

Type to move on.