Adding early CS challenge solutions
This commit is contained in:
24
CS4 - Challenge Solution/Main.java
Normal file
24
CS4 - Challenge Solution/Main.java
Normal file
@@ -0,0 +1,24 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Scanner scan = new Scanner(System.in);
|
||||
|
||||
System.out.print("Enter your age: ");
|
||||
int age = scan.nextInt();
|
||||
|
||||
scan.close();
|
||||
|
||||
if(age <= 18) {
|
||||
System.out.println("You're a youngin'");
|
||||
} else if(age > 18 && age <= 35) {
|
||||
System.out.println("The early adult years");
|
||||
} else if(age > 35 && age <= 55) {
|
||||
System.out.println("Middle aged, time to buy a really expensive car");
|
||||
} else if(age > 55 && age <= 64) {
|
||||
System.out.println("Getting old...");
|
||||
} else {
|
||||
System.out.println("Retirement! Time to live out the golden years.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user