-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAgeRange.java
More file actions
53 lines (34 loc) · 959 Bytes
/
AgeRange.java
File metadata and controls
53 lines (34 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.util.Scanner;
public class AgeRange{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter your age: ");
int age = input.nextInt();
if(age <= 12){
System.out.print("You are a child");
}
else if(age == 13 || age <= 19 ){
System.out.print("You are a teenager");
}
else if(age == 20 || age <= 59 ){
System.out.print("You are an adult");
}
else if(age == 20 || age <= 59 ){
System.out.print("You are an adult");
}
else{
System.out.print("you are senior");
}
}
}
/*
prompt the user to enter their age
create a variable that reads the users input
check if the user age is less than or equals to 12
print"You are a child"
check if the user age is equals to 13 or less than or equals to 19
print"You are a teenager"
check if the user age is equals to 20 or less than or equals to 59
print"You are an adult"
else" you are a senior"
*/