Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this assignment you will be required to implement an interactive menu, but first you should welcome the user with a one time only welcome
For this assignment you will be required to implement an interactive menu, but first you should welcome the user with a one time only welcome message.
Specific implementation requirements include
This menu will prompt the user to select one of three options.
Calculate Greatest Common Denominator
Perform Prime Factorization
Exit
Your program MUST handle invalid inputs by printing the INVALIDMENUSELECTION message followed by reprinting the menu.
Once a valid selection is made, your program will print the relevant prompt followed by prompting for the correct number of integers, one line at a time. There will be two prompts for GCD and one for PF
Your program should print the correct solution to the console then go back to the main menu.
If the user enters an invalid input, print the INVALIDINPUT message and return to the main menu. For GCD all integers must be positive. For PF the integer must be or greater.
For GCD the larger integer could be input either first or last
When the user selects exit, the EXITMESSAGE should be printed and the program should end.
The output should match exactly as expected. Use String variables provided in the starter code.
Your program should not crash for any input.
You may not utilize static or multiple Scanner objects.
You may not utilize java.lang.Math for this assignment.
You may not utilize System.exit
write this in java
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