-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMore07.SchoolCamp.js
More file actions
66 lines (52 loc) · 1.88 KB
/
More07.SchoolCamp.js
File metadata and controls
66 lines (52 loc) · 1.88 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function schoolCamp(season, groupType, studentsCount, nightStaysCount) {
let pricePerNight;
if (groupType === `girls` || groupType === `boys`){
if (season === `Winter`){
pricePerNight = 9.60;
} else if (season === `Spring`){
pricePerNight = 7.20;
} else if (season === `Summer`){
pricePerNight = 15;
}
} else if (groupType === `mixed`){
if (season === `Winter`){
pricePerNight = 10;
} else if (season === `Spring`){
pricePerNight = 9.50;
} else if (season === `Summer`){
pricePerNight = 20;
}
}
let totalPrice = pricePerNight * nightStaysCount * studentsCount;
if (studentsCount >= 50) totalPrice *= 0.50;
if (studentsCount >= 20 && studentsCount < 50) totalPrice *= 0.85;
if (studentsCount >= 10 && studentsCount < 20) totalPrice *= 0.95;
let sportType;
if (groupType === `girls`){
if (season === `Winter`){
sportType = `Gymnastics`;
} else if (season === `Spring`){
sportType = `Athletics`;
} else if (season === `Summer`){
sportType = `Volleyball`;
}
} else if (groupType === `boys`){
if (season === `Winter`){
sportType = `Judo`;
} else if (season === `Spring`){
sportType = `Tennis`;
} else if (season === `Summer`){
sportType = `Football`;
}
} else if (groupType === `mixed`){
if (season === `Winter`){
sportType = `Ski`;
} else if (season === `Spring`){
sportType = `Cycling`;
} else if (season === `Summer`){
sportType = `Swimming`;
}
}
console.log(`${sportType} ${totalPrice.toFixed(2)} lv.`);
}
schoolCamp(`Summer`, `boys`, 60, 70);