Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function schoolCamp(input) {
- let season = input[0];
- let group = input[1];
- let students = Number(input[2]);
- let nights = Number(input[3]);
- let price = 0;
- let sport;
- if (season === "Winter") {
- if (group === "boys") {
- price = students * nights * 9.60;
- sport = "Judo";
- } else if (group === "girls") {
- price = students * nights * 9.60;
- sport = "Gymnastics";
- } else {
- price = students * nights * 10;
- sport = "Ski";
- }
- } else if (season === "Spring") {
- if (group === "boys") {
- price = students * nights * 7.20;
- sport = "Tennis";
- } else if (group === "girls") {
- price = students * nights * 7.20;
- sport = "Athletics";
- } else {
- price = students * nights * 9.50;
- sport = "Cycling";
- }
- } else {
- if (group === "boys") {
- price = students * nights * 15;
- sport = "Football";
- } else if (group === "girls") {
- price = students * nights * 15;
- sport = "Volleyball";
- } else {
- price = students * nights * 20;
- sport = "Swimming";
- }
- }
- if (students >= 50) {
- price = price * 0.50;
- } else if (students >= 20 && students < 50) {
- price = price * 0.85;
- } else if (students >= 10 && students < 20) {
- price = price * 0.95;
- }
- console.log(`${sport} ${price.toFixed(2)} lv.`);
- }
Advertisement
Add Comment
Please, Sign In to add comment