Sunteți pe pagina 1din 1

/** * Name: David Willmore * Period: 7 * * Date: 26 September 2011 * * * File: ScannerStuff.

java * Description: Introduce Scanner objects and experiment with floating point numbers. */ import java.util.Scanner; public class ScannerStuff { public static void main (String [] args ) { // Please Experiment with SOP output statements. System.out.println ( "\n\tDavid Edward Willmore " ); System.out.println ( "\t>>>>>>>>>>>>>> W.T. Woodson HS, Pd. 7" ); // Declare Scanner object - name the object "reader": Scanner reader = new Scanner ( System.in ); // SOP is used to "prompt" the user for input System.out.println ( "Please type your first entry: " ); double a = reader.nextDouble(); System.out.println ( "Please type your second entry: " ); double b = reader.nextDouble (); double answer = a + b; System.out.println ( "a + b = " + answer ); System.out.println ("\nDoes this output surprise you?" ); } // main } // ScannerStuff

S-ar putea să vă placă și