Program to test students mathematical knowledge


Question 1) Write a program which helps teachers test their students in their mathematical knowledge. The program must use two generate methods generateNumber and generateOperation as follows:

a) public static int generateNumber(): generate the integer value randomly between (1-10)

b) public static String generateOperation(): generate the string symbol representing the operation (+, -,*) randomly. Hint: you could generate integers and use switch to select the correct string for your operation

c) public static boolean check (int x, int y, int result, String op): checks users answer matches result of performing operation op on x and y.
In main method you require to keep on asking user new question and user could stop the game by entering value 999. You need to keep track of users score, a correct answer would give the user 1 point and a wrong answer would take off one point.

Example:

**** Welcome to our math game ****

What is the result of 2 * 9 ? (999 to stop): 18
Excellent!
What is the result of 4 - 5 ? (999 to stop): -1
Excellent!
What is the result of 3 - 2 ? (999 to stop): 1
Excellent!
What is the result of 1 - 2 ? (999 to stop): 33
Sorry wrong value!
What is the result of 10 + 5 ? (999 to stop): 999

*************************************
Your total is 2

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Program to test students mathematical knowledge
Reference No:- TGS04545

Expected delivery within 24 Hours