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
This note was uploaded on 04/10/2008 for the course ENGR 131 taught by Professor Xiaowei during the Spring '07 term at Case Western.
- Spring '07