// Project: InchesToCm // Module: in2cm3 // Source code file: Main.java // Input a length in inches and convert it // centimeters. Use a method to perform the // conversion, placing the method in a the // separate source code file Convert.java. // The method call must be qualified by the // class where it is located. import java.util.Scanner; public class Main { public static void main(String[] args) { // Instantiate Scanner object. Scanner s = new Scanner(System.in); // Display input prompt. System.err.print("Input length in inches: "); // Read input from keyboard. String input = s.nextLine(); // Convert input to double. double inches = Double.parseDouble(input); // Convert length to centimeters. double cm = Convert.convertInchesToCm(inches); // Print output System.out.println("Length in cm: " + cm); } }