Question: o { System.out.print ( Method Selection Menu + = = = = = = = = = = = = = =

o {
System.out.print(
"
Method Selection Menu
"+
"=======================
"+
"1. Temperature Conversion (Fahrenheit to Celsius)
"+
"2. Distance Conversion (Yards to Feet and Inches)
"+
"3. Get Acronym
"+
"4. Triangle Generator
"+
"5. Exit
"+
"=======================
"+
"Enter selection (1-5): ");
try {
selection = Integer.parseInt(scnr.next());
} catch(NumberFormatException ex){
selection =0;
}
switch (selection){
case 1:
doTempConversion(scnr);
break;
case 2:
doDistConversion(scnr);
break;
case 3:
// flush input buffer
if (scnr.hasNextLine())
scnr.nextLine();
doGetAcronym(scnr);
break;
case 4:
doTriangle(scnr);
break;
case 5:
System.out.println("Exiting...");
break;
default:
System.out.println("Error: Invalid option");
}
} while (selection !=5);
scnr.close();

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 Programming Questions!