// X119SumTwoNumbers // Input two numbers, add them up, display the sum. // import java.util.Scanner; // Need Scanner class for input. public class X119SumTwoNumbers { public static void main( String args[] ) { //// 0. INITIALIZE: (Say hello.) System.out.printf( "Sum Two Numbers" ); System.out.printf( "(page 119/ problem 5)" ); System.out.println( ); System.out.printf( "AUTHOR: " ); System.out.printf( "bam" ); System.out.println( ); //// 1. INPUT: Get the two numbers (into variables first & second) int first, second; // Declare variables for input. Scanner keyboard; // Create a scanner. keyboard= new Scanner( System.in ); System.out.print("Enter 1st value: "); // Prompt for first input value. first= keyboard.nextInt(); System.out.print("Enter 2nd value: "); // Prompt for next input value. second= keyboard.nextInt(); //// 2. PROCESSING: Add the two numbers. int sum; // Declare a vbl for the sum. sum= first + second; // Compute the sum. //// 3. OUTPUT: Show the result. System.out.print( "The sum is: " ); System.out.println( sum ); //// 4. FINALIZE: Say goodnight, Gracie. System.out.print( "Ththth-thth-th-th-that's all, folks!" ); } }