Question: Purpose Java looping and format output implementations Program Specifications: You are to design a math tutoring program that can be used as a math tutor
Purpose
Java looping and format output implementations
Program Specifications:
You are to design a math tutoring program that can be used as a math tutor for a young
student. This program will display a menu allowing user to select an addition, a subtraction,
or a multiplication problem. The last selection on the menu should let user exit the program.
The menu looks like the following:
Math Tutoring Game
Addition
Subtraction
Multiplication
Exit the Game
Here are the steps to play the game:
The program will prompt the user to enter a selection
The program then displays two random numbers between and that are to be
either added, subtracted, or multiplied such as:
The program should wait for the user to enter the answer. If the answer is correct, a
message of congratulation should be printed. If the answer is incorrect, a message
should be printed showing correct answer.
After user has finished the math problem, the program should display the menu
again. This process is repeated until the user selects the choice to exit the
program.
Input Validation: If the user selects an item not on the menu, display an error
message and display the menu again.
To Solve this problem, we can identify IPO and develop the Pseudocode.Purpose
Java looping and format output implementations
Program Specifications:
You are to design a math tutoring program that can be used as a math tutor for a young
student. This program will display a menu allowing user to select an addition, a subtraction,
or a multiplication problem. The last selection on the menu should let user exit the program.
The menu looks like the following:
Math Tutoring Game
Addition
Subtraction
Multiplication
Exit the Game
Here are the steps to play the game:
The program will prompt the user to enter a selection
The program then displays two random numbers between and that are to be
either added, subtracted, or multiplied such as:
The program should wait for the user to enter the answer. If the answer is correct, a
message of congratulation should be printed. If the answer is incorrect, a message
should be printed showing correct answer.
After user has finished the math problem, the program should display the menu
again. This process is repeated until the user selects the choice to exit the
program.
Input Validation: If the user selects an item not on the menu, display an error
message and display the menu again.
To Solve this problem, we can identify IPO and develop the Pseudocode.
Input Menu selection
User answer
Processing Use random number to generate numbers between and
inclusive
Generate math problem from random numbers and user selected
operation
Prompt for user answer and check user answer for correctness
Repeat the process until user select exit the program
Output Display message about users answer
Lab Assignment
COSC Programming Fundamentals I Java
Variables menuSelection, firstNum, secondNum userAnswer, correctAnswer all
variables are int type
Constants final int MIN MAX ;
the range of random number
Random num To generate random number, use Math.random method
To generate number in range inclusive: Use constant MIN and MAX
MIN intMathrandomMAXMIN
Pseudocode Start a looping structure
Display menu See above menu display
Prompt user to enter menu selection:
Validate menu selection
Display proper message for invalid selection or Exit the Game selection
Generate random numbers between inclusive
Display problem See above problem display
Prompt user to enter answer
Check user answer to see if it is correct and display proper message
Repeat the same process until user selects to exit the program
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
