Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let cruise = input.shift();
- let cabin = input.shift();
- let nights = Number(input.shift());
- let price = 0;
- switch (cruise) {
- case "Mediterranean":
- switch (cabin) {
- case "standart cabin": price = nights * 27.50; break;
- case "cabin with balcony": price = nights * 30.20; break;
- case "apartment": price = nights * 40.50; break;
- } break;
- case "Adriatic":
- switch (cabin) {
- case "standart cabin": price = nights * 23.00; break;
- case "cabin with balcony": price = nights * 26.60; break;
- case "apartment": price = nights * 39.80; break;
- } break;
- case "Aegean":
- switch (cabin) {
- case "standart cabin": price = nights * 23.00; break;
- case "cabin with balcony": price = nights * 26.60; break;
- case "apartment": price = nights * 39.80; break;
- } break;
- }
- if (nights > 7) {
- price = price * 0.75;
- }
- console.log(`Annie's holiday in the ${cruise} sea costs ${(price*4).toFixed(2)} lv.`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement