Assignemnt #37 How Old Are You Specifically
Code
/// Name: DeeJay Cerezo
/// Period: 7
/// Program Name: Hoe Old Are Your Specifically
/// File Name: HowOldAreYouSpec.java
/// Date Finished: 11/3/2015
import java.util.Scanner;
class HowOldAreYouSpec {
public static void main(String[]args) {
Scanner keyboard = new Scanner(System.in);
String name;
int age;
System.out.print("What is your name? Sorry, your name is so generic that I forget. ");
name = keyboard.next();
System.out.print("Hello " + name + ", how old are you? I forgot. Sorry. ");
age = keyboard.nextInt();
if ( age < 16 )
{
System.out.println("You cannot drive.");
}
else if ((age == 16) || (age <= 18))
{
System.out.println("You can drive but not vote.");
}
else if ((age == 18) || (age <= 24))
{
System.out.println("You can vote but not rent a car.");
}
else if (age > 25)
{
System.out.println("You can do all the things.");
}
else
{
System.out.println("");
}
}
}
Picture of the output