Advertisement
lol1234561

Untitled

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