Unformatted text preview: String replyString int correct = number1 - number2 if (correct == answer) replyString = "You are correct!" else if (-1 <= correct - answer && correct - answer <= 1) replyString = "You're really close, but the answer is " + correct else replyString = "Your answer is wrong.\n" + number1 + " - " + number2 + " should be " + (number1 - number2) JOptionPane.showMessageDialog(null, replyString) } } // 3. Prompt the student to answer hwhat is number1 h number2?h...
View Full Document
- Spring '07
- int temp, int answer, number2, random single-digit integers