/* * Author: Johann Bach * MAT 2170, Section 1 * Exercise: Lab 1, #2 * Date: August 28, 2007 * File: Add2Integers.java * Purpose: This program requests two integers * from the user, adds them together, and displays * the sum. * */ import acm.program.*; public class Add2Integers extends ConsoleProgram { public void run() { // Prompt for and obtain two integers from the user, // then find and display their sum println("This program adds two integers."); int n1 = readInt("Enter first integer : "); int n2 = readInt("Enter second integer : "); int total = n1 + n2; println("The total is " + total + "."); } }