Question: 6.1 Write a static method called getUserChoice(), which returns an integer as menu choice based on the requirement in the problem 5.1 (Homework #5). You

 6.1 Write a static method called getUserChoice(), which returns an integer 6.1 Write a static method called getUserChoice(), which returns an integer as menu choice based on the requirement in the problem 5.1 (Homework #5). You can re-use the code you wrote from HW#5.1 or from the model answer provided. Modify the main method and all your new method getUserChoice to get the choice from user. Print the choice given by the user in the main method.

Edit Source Horacio Naviyate Seal eclipse-workspace - First JavaProject/src/getUserChoice.java - Eclipse IDE D getTwoFloatsstatie.java getUserChoice.java D Gettwofloats.java 1e import java.util.Scanner: 3 public class getUserChoice 4 public getUserChoice() { Je static void getUserChoice() { Scanner scan = new Scanner(System.in); //scanner that will read the integer int i; System.out.println("Welcome to sorting programin \t1. Title \t2. Rank \t3. Date \t4. Stars nits. Likesinin System.out.println(" "); do[//loop until we have correct input System.out.print("Enter choice between 1 and 5 only: "); try { i = scan.nextInt(); 1/waits for user input if (i >= 1 66 i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!