Advertisement
Blonk

Untitled

Sep 12th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner keyboard = new Scanner (System.in);
  8.  
  9.         String name;
  10.         int age;
  11.         String drive = "You can't drive";
  12.         String vote = "You can't vote";
  13.         String rent = "You can't rent a car";
  14.         String legal = "You can do anything that's legal";
  15.  
  16.         System.out.print("Hey, what's your name? ");
  17.         name = keyboard.next();
  18.  
  19.         System.out.print("Ok " + name + ", how old are you? ");
  20.         age = keyboard.nextInt();
  21.  
  22.         if (age < 16){
  23.             System.out.println(drive + ", " + rent + " and " + vote);
  24.         } else if (age < 18){
  25.             System.out.println(vote + ", " + rent);
  26.         } else if (age < 25){
  27.             System.out.println(rent);
  28.         } else {
  29.             System.out.println(legal);
  30.         }
  31.  
  32.  
  33.  
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement