-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEx3_Excursion.java
53 lines (45 loc) · 1.88 KB
/
Ex3_Excursion.java
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
49
50
51
52
53
package Original_Exam_1;
import java.util.Scanner;
public class Ex3_Excursion {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int people = Integer.parseInt(scanner.nextLine()); // брой хора
String season = scanner.nextLine(); // сезон
double allSum = 0.0;
switch (season) {
case "spring":
if (people <= 5){
allSum = people * 50.00;
} else if(people >= 5) {
allSum = people * 48.00;
}
break;
case "summer":
if (people <= 5) {
allSum = (people * 48.50) - ((15 * 1.0/ 100) * (people * 48.50)) ;
// double withDiscount = allSum - ((15 * 1.0/ 100) * allSum);
} else if(people > 5) {
allSum = (people * 45.00) - ((15 * 1.0/ 100) * (people * 45.00));
// double withDiscount = allSum - ((15 * 1.0/ 100) * allSum);
}
break;
case "autumn":
if (people <= 5) {
allSum = people * 60.00;
} else if (people > 5) {
allSum = people * 49.50;
}
break;
case "winter":
if (people <= 5) {
allSum = (people * 86.00) + ((8 * 1.0/ 100) * (people * 86.00) ) ;
// double withDiscount = allSum - ((8 * 1.0/ 100) * allSum);
} else if (people > 5){
allSum = (people * 85.00) + ((8 * 1.0/ 100) *(people * 85.00) ) ;
// double withDiscount = allSum + ((8 * 1.0/ 100) * allSum);
}
break;
}
System.out.printf("%.2f leva.", allSum);
}
}