Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the Java code for an educational application for students to practice mathematical operations. As shown in the sample outputs below, the application will ask

Write the Java code for an educational application for students to practice mathematical operations.
As shown in the sample outputs below, the application will ask the user for the code of his desired mathematical operation to practice. Then itll ask for the maximum number of digits in the first random integer, then the maximum number of digits in the second random integer.
If the answer input by the user is correct, the application will print out Correct! on the screen, then itll ask if the user wants to continue or to exit.
If the user enters a wrong answer, the application will print out Try again... on the screen and will keep asking the user for an answer until the user enters a correct answer, after which itll ask if the user wants to continue or to exit.
If the user wanted to practice a division or modulus problem, the application must not generate zero for the second random number (why?).
No need to use double or long, just int, even for division (see Sample Output 3 below).
No need for input validation:
1. For the operation code, any invalid input (<1 or>5) should be treated as modulus.
2. Assume that the user will not enter 0 or a negative value when asked for the maximum digits
of the random numbers.
3. For the Another problem? question, if the user inputs any integer other than 1 the
application will exit (see Sample Output 5 below).
Write the Java code for an educational application for students to practice mathematical operations.
As shown in the sample outputs below, the application will ask the user for the code of his desired mathematical operation to practice. Then itll ask for the maximum number of digits in the first random integer, then the maximum number of digits in the second random integer.
If the answer input by the user is correct, the application will print out Correct! on the screen, then itll ask if the user wants to continue or to exit.
If the user enters a wrong answer, the application will print out Try again... on the screen and will keep asking the user for an answer until the user enters a correct answer, after which itll ask if the user wants to continue or to exit.
If the user wanted to practice a division or modulus problem, the application must not generate zero for the second random number (why?).
No need to use double or long, just int, even for division (see Sample Output 3 below).
No need for input validation:
1. For the operation code, any invalid input (<1 or>5) should be treated as modulus.
2. Assume that the user will not enter 0 or a negative value when asked for the maximum digits
of the random numbers.
3. For the Another problem? question, if the user inputs any integer other than 1 the
application will exit (see Sample Output 5 below).
All the above points can be seen in the snapshots below.
Sample Output 1

FInis apolicarion is ror stucents to practice on marnematical operations

Please select a mathematical operation:

ma auotracuion

38 uolicarion

5: ModuLus

Operation Code: 1

Maximum digits of the first random integer? 1

Maximum digits of the second random integer? 1

Try again...

correct

Another problem? (1: Yes, 2: No): 2

bye

Sample Output 2

This application is for students to practice on mathematical operations

Please select a mathematical operation:

  1. Addition
  2. Subtraction
  3. Multiblication DIV1S1ON

3. MOQUIUS

Operation code:

Maximum digits of the first random integer? 1

Maxlmum digits of the second random integerr

8 - 62

Answer: -54

Correct!

Another problem? (1: Yes, 2: No): 1

Please select a mathematical operation:

  1. Addition
  2. Subtraction
  3. Multiplication 8sion

5: Modulus

Operation code: 3

Maximum digits of the first random integer?

Maxlmum digits of the second random integer?

3466 * 597171 = ?

Answer: 2069794686

correct

Another problem? 1: Yes, 2: No): 2

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

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions