// HeightToCentimeters.java Copyright (c) 2006 Kari Laitinen // http://www.naturalprogramming.com // 2006-02-12 File created. // 2006-02-12 Last modification. // This file is a solution to Exercise 5-5. import java.util.* ; class HeightToCentimeters { public static void main( String[] not_in_use ) { Scanner keyboard = new Scanner( System.in ) ; double feet_of_height, inches_of_height ; double height_in_centimeters ; System.out.print( "\n This program can convert a height given as" + "\n feets and remaining inches to centimeters. " + "\n Please, give the feet of your height: " ) ; feet_of_height = keyboard.nextDouble() ; System.out.print( "\n Please, give the remaining inches: " ) ; inches_of_height = keyboard.nextDouble() ; height_in_centimeters = ( feet_of_height * 12 + inches_of_height ) * 2.54 ; System.out.print( "\n " + feet_of_height + " feet and " + inches_of_height + " inches is " + height_in_centimeters + "\n" ) ; } }