Design, write in Java, test and document a program that will help primary school students to learn multiplication. The program is to allow the users to enter a school grade-level activity. A grade level of 1 means that the program should use only single-digit numbers in the problems, a grade level of 2 means that the program should use numbers as large as two digits. Only integer numbers are to be handled.

Use a java.util.Random class object to produce two positive numbers. The program should prompt the user with a question, such as What is 5 times 7 ? The user then inputs the answer. Next, the program checks the user's answer. If the answer is correct, program displays one of the following responses selected randomly:

Very good!
Excellent!
Nice work!
Keep up the good work!

If the answer is wrong, display one of the following messages selected randomly,

No. Please try again.
Wrong. Try once more.
Don’t give up! Try again.
No. Keep Trying.

and let the user try the same question repeatedly until the user finally gets it right or gives up. (eg, by entering a -1 in response to the question) Use random number generation to choose a number from 1 to 4 that will be used to select an appropriate response to each answer. [Hint: Use a switch statement to issue the responses.] A separate method should be used to generate each new question. This method should be called once when the application begins execution and each time the user answers the question correctly or gives up in case of incorrect answers. The program is to keep a count of the number of correct answers and the number of incorrect answers entered by the user. After the user types 10 answers, the program should display the total number of correct answers, the total number of incorrect answers, and the percentage of correct answers. If the percentage is lower than 75%, display the message "Please ask your tutor for extra help". If the percentage is greater than or equal to 90%, display the message Brilliant!. The program should then reset the counts so another user can try it. The program should loop around until the users do not want to answer any more questions. The program should be well-structured and should have a reasonable set of methods in addition to the main method. Please note that the question does not require you to use more than one class. However, you are welcome to do so if you wish. Your program should also include a method (eg, StudentInfo( )) to output your student details (name, student number, mode of enrolment, tutor name, tutorial attendance day and time) at the start of program results. The test results (sample program output) should be submitted as part of your external documentation.

[Hint: The Random class of java library (java.util.Random) implements a random number generator. To generate random numbers, you construct an object of the class Random, and then use the method nextInt(n) which returns a number between 0 (inclusive) and n (exclusive). Eg, import java.util.Random; .. Random generator = new Random(); //generate a random number between 0 and 9 (inclusive) int nextRand = generator.nextInt(10) ; ] Here is some sample output (the user input is in bold):

Enter the grade (1 or 2) of the user: 1
What is 2 times 5 ? Enter your answer: 10
Very good!
What is 2 times 8 ? Enter your answer: 28
No. Please try again.
Enter your answer (-1 to skip the question): 16
Nice work!
What is 9 times 9 ? Enter your answer: 99
Wrong. Try once more.
Enter your answer (-1 to skip the question): 90
No. Please try again.
Enter your answer (-1 to skip the question): -1
What is 6 times 9 ? Enter your answer: 54
Excellent!
What is 2 times 7 ? Enter your answer: 14
Nice work!
What is 6 times 8 ? Enter your answer: 48
Nice work!
What is 1 times 3 ? Enter your answer: 3
Very good!
What is 9 times 1 ? Enter your answer: 9
Keep up the good work!

The number of correct answers = 7
The number of incorrect answers = 3
Percentage of correct answers = 70%
Please ask your tutor for extra help.
Do you wish to continue (Y/N)? y
Enter the grade (1 or 2) of the user: 2
What is 59 times 34 ?
Enter your answer: 2006
Keep up the good work!
What is 93 times 29 ?
Enter your answer: 2697
Very good!
What is 53 times 45 ?
Enter your answer: 265
Wrong. Try once more.
Enter your answer (-1 to skip the question): 2395
No. Keep trying.
Enter your answer (-1 to skip the question): 2385 Nice work!
What is 6 times 84 ?
Enter your answer: 504
Very good!
What is 83 times 63 ?
Enter your answer: ......
...... etc.

The above example did not show how the user can exist the program. Think of a way that you can allow user to exit the program (not using Ctrl+C)

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.