Advertisement
MrsMcLead

else if

Feb 10th, 2014
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Input2
  4. {
  5.   public static void main(String[]args)
  6.   {
  7.     Scanner scanner = new Scanner(System.in);
  8.     System.out.println("How old are you?");
  9.     int age = scanner.nextInt();
  10.    
  11.     if(age >= 70)
  12.     {
  13.       System.out.println("You're old.");
  14.     }
  15.    
  16.     else
  17.     {
  18.       System.out.println("You still have time.");
  19.     }
  20.    
  21.     System.out.println("How tall are you in inches?");
  22.     int height = scanner.nextInt();
  23.    
  24.     if (height < 2)
  25.     {
  26.       System.out.println("Tyler is scared.");
  27.     }
  28.      
  29.     else if (height <= 50)
  30.     {
  31.       System.out.println("You are short.");
  32.     }
  33.    
  34.     else if (height <= 70)
  35.     {
  36.      System.out.println("You are average.");
  37.     }
  38.     else
  39.     {
  40.       System.out.println("You are tall.");
  41.     }
  42.        
  43.    
  44.   }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement