1. Engineering
  2. Computer Science
  3. there is already an existing class called sizes with an...

Question: there is already an existing class called sizes with an...

Question details

There is already an existing class called Sizes, with an existing main method.

Inside the Sizes class, create a method called menu. The purpose of this method is to display the menu on the screen and allow the user to make a choice from the menu.

Do not change any of the existing code in the main method, and do not add code to the main method. Changing the main method in any way will give you an automatic grade of zero on this part of the assignment.

This method does not need to accept any parameters from the main method. Choices should be read into the menu method from the keyboard as a number 1, 2, 3 or 4. This method will need to contain a loop which will repeat the process of displaying the menu and getting an input value as long as the user does not enter a correct menu option. After a correct menu option has been entered, the method should return that choice back to the main method.

Note that this method is required to verify that the entered choice is correct, so the main method does not have to do that task.

The following is an example of what your MIGHT see on the screen when your menu method executes. The exact output depends on what values that the user types in while the program runs. The user's inputted values are shown below in italics. Note that your method must display the exact formatting shown here - including the spaces and blank lines.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution