Question
Write a static method called giveProblems that takes a console scanner and an integer n as paramete rs and that makes up n multiplication problems
Write a static method called giveProblems that takes a console scanner and an integer n as paramete rs and that makes up n multiplication problems for the user to solv e. Each multiplication problem involves choosing two numbers that are each between 1 and 12 inclusive. The use r should be prompted for the answer and should be told whether their answer was correct or incorrect. The method should also report the number of problems solved correctly and the number of problems given.
For example, if the following calls are made: Scanner console = new Scanner(System.in); giveProblems(console, 5);
We would expect interaction like the following (user input bold and underlined):
10 * 6 =? 60 correct
9 * 9 =? 82 incorrect...the answer was 81
4 * 10 =? 40 correct
3 * 4 =? 13 incorrect...the answer was 12
8 * 5 =? 40 correct 3 of 5 correct
In this log, the user entered 5 answers (60, 82, 40, 13, 40). All o ther text was produced as output by the method. Notice that there is a final line of output indicating the overall results. Your method must exactly reproduce the format of this log. Your method should construct a Random object to use for making up random problems. You may assume that the integer passed to your method is greater than 0 and that the user always enters an integer when prompted.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started