Assignemnt #46 and AgeMessages3
Code
/// name: Leila Ordukhani
/// period: 6
/// program name: Thirty-Five Program
/// file name: AgeMessages3.java
/// date finished: 10/28/15
import java.util.Scanner;
public class AgeMessages3
{
public static void main(String[] args)
{
String name;
int age;
Scanner keyboard = new Scanner(System.in);
System.out.print("Your name: ");
name = keyboard.next();
System.out.print("Your age: ");
age = keyboard.nextInt();
if (age < 16)
{
System.out.println("You cannot drive.");
}
else if (age < 17)
{
System.out.println("You can drive but not vote.");
}
else if (age < 24)
{
System.out.println("You can vote but not rent a car.");
}
else if (age > 25)
{
System.out.println("You can basically do anything.");
}
}
}
Picture of the output