-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTheatrePromo.java
More file actions
41 lines (39 loc) · 1.13 KB
/
Copy pathTheatrePromo.java
File metadata and controls
41 lines (39 loc) · 1.13 KB
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
import java.util.Scanner;
public class TheatrePromo {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String day = scanner.nextLine().toLowerCase();
int age = Integer.parseInt(scanner.nextLine());
var price = 0;
if (age>=0 && age <=18){
if(day.equals("weekday")){
price = 12;
}else if(day.equals("weekend")){
price = 15;
}else{
price = 5;
}
}else if (age >18 && age <=64){
if(day.equals("weekday")){
price = 18;
}else if(day.equals("weekend")){
price = 20;
}else{
price = 12;
}
}else if (age >64 && age <=122){
if(day.equals("weekday")){
price = 12;
}else if(day.equals("weekend")){
price = 15;
}else{
price = 10;
}
}else{
System.out.println("Error!");
}
if(price!=0){
System.out.printf("%s$",price);
}
}
}