/* GetKeyboard1.java CIS 160 David Klick 2015-09-02 Get keyboard input - one item Note: This program will crash if the user enters unexpected input. */ import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class GetKeyboard1 { public static void main(String[] args) throws IOException { // Set up object to read from keyboard BufferedReader kbd = new BufferedReader( new InputStreamReader(System.in)); // Declare variables double x; String s; // Get input System.out.print("Enter a floating-point number: "); s = kbd.readLine(); x = Double.parseDouble(s); // Display number entered System.out.println("The number entered was: " + x); } } /* Sample of one run of program: Enter a floating-point number: 4.600 The number entered was: 4.6 */