10 Points Possible:
Question
(remember @author Your Name in a comment)a
and b
correct
that has a int
parameter returns true if the parameter is the correct sum a+bcorrect
that has a String
parameter returns true if the parameter is the correct sum a+b. Use Integer.parseInt()
to convert the String
to an int
toString
that returns the question “What is a + b?”Scanner
, and Question
. (Hints: Use import java.util.Scanner;
before the class declaration, and make a new Scanner
with the parameter System.in
so it gets input from the user at the keyboard). There is a method called nextLine
that will return the user's input as a String
. (Here is a link that give examples of making an instance of the Scanner class, and here is the link to the full API .)while
loop that keeps asking the question until the question is answered correctly.for
loop so you ask 3 different questions. Here is how it might look: