Advertisement
jbozhich

Assignment 4.4 Problem 1.1

Oct 1st, 2014
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Problem1part1 {
  3.  
  4.  
  5.     public static void main(String[] args) {
  6.         // TODO Auto-generated method stub
  7.  
  8.         Scanner keyboard = new Scanner(System.in);
  9.         int age1, age2;
  10.         System.out.println("Enter an age");
  11.         age1 = keyboard.nextInt();
  12.         System.out.println("Enter another age");
  13.         age2 = keyboard.nextInt();
  14.         if (age1 > age2)
  15.             System.out.println("The age of the first entry is greater than the second.");
  16.         else if (age1 < age2)
  17.             System.out.println("The age of the second entry is greater than the first.");
  18.         else
  19.             System.out.println("The two ages are equal.");
  20.        
  21.  
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement