Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed 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

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

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

close

Answered: 1 week ago

Question

2 The main characteristics of the market system.

Answered: 1 week ago