Answer:
import java.util.Scanner;
public class InchConversion
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter inches: ");
double inches = input.nextDouble();
inchesToFeet(inches);
inchesToYards(inches);
}
public static void inchesToFeet(double inches){
double feet = inches / 12;
System.out.println(inches + " inches = " + feet + " feet");
}
public static void inchesToYards(double inches){
double yards = inches / 36;
System.out.println(inches + " inches = " + yards + " yards");
}
}
Explanation:
In the inchesToFeet() method that takes one parameter, inches:
Convert the inches to feet using the conversion rate, divide inches by 12
Print the feet
In the inchesToYards() method that takes one parameter, inches:
Convert the inches to yards using the conversion rate, divide inches by 36
Print the yards
In the main:
Ask the user to enter the inches
Call the inchesToFeet() and inchesToYards() methods passing the inches as parameter for each method