Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner input = new Scanner (System.in);
- System.out.print("Hey, what's your name? ");
- String name = input.nextLine();
- System.out.print("OK " + name + ", how old are you? ");
- int age = input.nextInt();
- if (age < 16 ) {
- System.out.println("You can't drive.");
- }
- if (age < 18 ){
- System.out.println("You can't vote");
- }
- if ( age < 25) {
- System.out.println("You can't rent a car.");
- }
- if (age >= 25) {
- System.out.println("You can do anything that's legal.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement