Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Third International Conference Achids 2011 Daegu Korea April 2011 Proceedings Part 2 Lnai 6592

Authors: Ngoc Thanh Nguyen ,Chong-Gun Kim ,Adam Janiak

2011th Edition

3642200419, 978-3642200410

More Books

Students also viewed these Databases questions

Question

Comment should this MNE have a global LGBT policy? Why/ why not?

Answered: 1 week ago