Question: import java.util.Scanner; public class Converter { public static void main ( String [ ] args ) { / / Below this comment: declare and instantiate

import java.util.Scanner;
public class Converter {
public static void main(String[] args){
// Below this comment: declare and instantiate a Scanner
Scanner input = new Scanner(System.in);
// Below this comment: declare any other variables you may need
// to store the user's input and the Feet and Inches equivalent value
// Below this comment: collect the required inputs
System.out.print("Enter distance in Meters: ");
double userInput = input.nextDouble();
// Below this comment: call your MetersToFeetAndInches method
String metersToFeet = MetersToFeetAndInches(userInput);
// Below this comment: disply the required results
System.out.println(userInput +" meters in Feet and Inches is : "+ metersToFeet);
}
// define your MetersToFeetAndInches method here below
public static String MetersToFeetAndInches(double value){
//formula to convert meters to inches
double metersToInches = value *39.37f;
//Formula to convert feet
int feet =(int) metersToInches /12;
double inches =(metersToInches)%12;
return String.format("%d\'%.2f\"'",feet,inches);
}
}

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!