AgeMsg3

Code

import java.util.Scanner;

public class AgeMsg3
{
    public static void main(String[] args )
    {
    
    Scanner keyboard = new Scanner (System.in);
    
    String name;
    int age;
    
    System.out.println( " Your name " );
    name = keyboard.next();
    
    System.out.println( " Your age " );
    age = keyboard.nextInt();
        
    if ( age < 16 )
    {
        System.out.println( " you can't do anything " );
    }
    if ( age > 16 && age <17 )
    {
        System.out.println( " you could drive but no voting for you, " + name );
    }
    if ( age > 18 && age < 24 )
    {
        System.out.println( " guess you can vote but no renting cars, " + name );
    }
    if ( age > 25 )
    {
        System.out.println( " you are pretty much god, do what you want, " + name );
    }
    }
}

AgeMsg3

Assignment 46