Assignemnt #40
Code
/// Name: Sam Wilson
/// Period: 6
/// Program Name: agemsg
/// File Name: agemsg.java
/// Date Finished: 10/18/2015
import java.util.Scanner;
public class agemsg
{
public static void main( String [] args )
{
Scanner keyboard = new Scanner(System.in);
String Name;
int Age;
System.out.println("What is your name?");
Name = keyboard.next();
System.out.println("Ok "+Name+", how old are you?");
Age = keyboard.nextInt();
System.out.println("You Name: "+Name);
System.out.println("Your Age: " +Age);
if ( Age < 16 )
{
System.out.println("You can't drive, "+Name);
}
if ( Age >= 16 && Age <=17 )
{
System.out.println("You can drive but not vote,"+Name);
}
if ( Age >=18 && Age <= 24 )
{
System.out.println("You can vote but not rent a car,"+Name);
}
if ( Age >= 25 )
{
System.out.println("You can do anything legal now "+Name);
}
}
}
Picture of the output