Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use a driver program named MathTest that: \' Generates two random numbers betwee

ID: 3535034 • Letter: U

Question

Use a driver program named MathTest that:

' Generates two random numbers between 0 and 9

- Instantiates the Math class and passes the two random numbers to a constructor in the Math class

' Calls the menu() method Create a public class named Math that contains:

- A constructor that populates two instance (class) variables named numl and num2

' A method named menu that: — displays the menu for an addition, subtraction, multiplication, or division question — uses a while loop to validate the response is between 1 and 4 * uses a switch statement to call the appropriate method for addNumbers, subtractNumbers, multiplyNumbers, or divideNumber

– The methods addNumbers, subtractNumbers, multiplyNumbers, or divideNumbers:

1. calculate the answer

2. display the question, for example,

"How much is x plus y?"

replacing x and y with the random numbers that were populated by the constructor

3. store the student's guess

4. calls the method checkResponse passing the answer and the

student's guess

– A method named checkResponse:

1. if the student's guess is incorrect, displays the correct answer else displays the message "Very Good!"

• In the subtractNumbers and divideNumbers methods, if the num2 value is greater than the num1 value, swap them

– In the divideNumbers method, add a try/catch block to catch an ArithmeticException for an attempt to divide by zero

Explanation / Answer

Working...