MrDoyle

How Old Are You Specifically?

Sep 18th, 2020
872
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner input = new Scanner (System.in);
  7.  
  8.         System.out.print("Hey, what's your name? ");
  9.         String name = input.nextLine();
  10.  
  11.         System.out.print("OK " + name + ", how old are you? ");
  12.         int age = input.nextInt();
  13.  
  14.         if (age < 16 ) {
  15.             System.out.println("You can't drive.");
  16.         } else if (age < 18 ){
  17.             System.out.println("You can drive but not vote");
  18.         }else if ( age < 25) {
  19.             System.out.println("You can vote but not rent a car.");
  20.         }else {
  21.             System.out.println("You can do pretty much anything.");
  22.         }
  23.     }
  24. }
RAW Paste Data