If Statement #37 (No comment)
Code
/// Name: Amir Salehi
/// Period: 7
/// Program Name: How Old are You, Specifically?
/// File Name: HowOldAreYouSpecifically.java
/// Date Finished: 10/15/2015
import java.util.Scanner;
public class HowOldAreYouSpecifically {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String name;
int age;
System.out.print("Hello, what's your name again? ");
name = input.nextLine();
System.out.print("Okay, " + name + ", how old are you? ");
age = input.nextInt();
if (age < 16) {
System.out.println("You can't 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 {
System.out.println("You can do pretty much anything.");
}
}
}
Picture of the output