Question: import java.util.Scanner; public class Methods { public static void main ( String [ ] args ) { / / Declare and instantiate a Scanner Scanner

import java.util.Scanner;
public class Methods {
public static void main(String[] args){
// Declare and instantiate a Scanner
Scanner scnr = new Scanner(System.in);
// Continue serving method selection menu
// until "Exit" option is selected
int selection;
do {
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();
}// end of main method
public static void doTempConversion(Scanner scnr){
// TODO: Remove placeholder message
System.out.println("Not yet implemented.");
// Below this comment: declare any other variables you may need
// to store the user's input and the Celsius equivalent value
fareinheitToCelsius
// Below this comment: prompt the user to enter the required input(s)
// Below this comment: collect the required input(s) from the user
System.out.println("Enter temperature in Fareinheit : ");
fareinheit = scnr.nextDouble();
// Below this comment: call your fahrenheitToCelsius method
celsius = fareinheitToCelsius (farenheit);
// Below this comment: display the required results
System.out.println("%2f degrees Farenheit is %.2f Celsius
", farenheit, celsius);
}
public static double (fareinheitToCelsius(double))
double c =(5.0/9)
}
// define your fahrenheitToCelsius method here below
public static void doDistConversion(Scanner scnr){
// TODO: Remove placeholder message
System.out.println("Not yet implemented.");
// Below this comment: declare any other variables you may need
// to store the user's input and the Feet and Inches equivalent value
double yards;
String feetandInches;
// Below this comment: collect the required inputs
System.out.println(" Enter the distance in yards");
yards = scnr.nextDouble();
// Below this comment: call your yardsToFeetAndInches method
feetandInches = yardToFeetAndInches(yards);
// Below this comment: disply the required results
System.out.println("%2f yards in feet and Inches is :%/n", yards, feetandInches);
}
// define your yardsToFeetAndInches method here below
public static String yardToFeetAndInches(double y);
{
double totalInches = y*36;
int feet = int totalInches/12;
return String.format("d\%.2f", feet, inches)
}
public static void doGetAcronym(Scanner scnr){
// TODO: Remove placeholder message
System.out.println("Not yet implemented.");
// Below this comment: declare and instantiate a Scanner
Scanner scanner = new Scanner(System.in);
// Below this comment: declare any other variables you may need
String scorewords;
String acronyms;
// Below this comment: collect the required inputs
System.out.println("Enter some words : ");
scorewords = scnr.nextLine();
// Below this comment: call your required method
acronyms = getAcronym(scorewords);
// Below this comment: disply the required results
System.out.println("Acronym is %s : %s
", scorewords, acronym);
}
// define your getAcronym method here below
public static String getAcronyms(String words){
String acronyms = words.substring(beginindex:0,endIndex:1);
int space = words.indexOf("");
while(spaceIndex !=1)
{
acronym += words.substring("spaceIndex+1, spaceIndex+2);
spaceIndex = words.indexOf("", spaceIndex+1);
}
return null.toUpperCase();
)
}
public static void doTriangle(Scanner scnr){

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!