This preview shows page 1. Sign up to view the full content.
Unformatted text preview: // What happens if the constant is not a double? / double feet, inches; int wholeInches; i Scanner ourScanner = new Scanner(System.in); S // What happens here if the user types in an integer value? System.out.print(&quot;Enter a number in feet: &quot;); feet = ourScanner.nextDouble(); f inches = feet * INCHES_IN_FOOT; i System.out.println(&quot;\n&quot; + feet + &quot; feet is &quot; + inches + &quot; inches.\n&quot;); S // What happens here if the user types in a decimal value? System.out.print(&quot;Now, enter a whole number in inches: &quot;); wholeInches = ourScanner.nextInt(); w feet = wholeInches / INCHES_IN_FOOT; f System.out.println(&quot;\n&quot; + wholeInches + &quot; inches is &quot; + feet + &quot; feet.\ n&quot;); n } }...
View Full Document
This note was uploaded on 03/05/2011 for the course CSCI 384 taught by Professor Drchan during the Spring '11 term at CA Health Sciences.
- Spring '11