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;
- if (cruise == "Mediterranean") {
- if (cabin == "standard cabin") {
- price = ( 27.50);
- } else if (cabin == "cabin with balcony") {
- price = ( 30.20);
- } else {
- price = ( 40.50);
- }
- }
- if (cruise == "Adriatic") {
- if (cabin == "standard cabin") {
- price = ( 22.99);
- } else if (cabin == "cabin with balcony") {
- price = ( 25.00);
- } else if (cabin == "apartment") {
- price = (34.99);
- }
- }
- if (cruise == "Aegean") {
- if (cabin == "standard cabin") {
- price = ( 23.00);
- } else if (cabin == "cabin with balcony") {
- price = ( 26.60);
- } else if (cabin == "apartment") {
- price = ( 39.80);
- }
- }
- let sum = price * nights * 4;
- if (nights > 7) {
- sum *= 0.75;
- }
- console.log(`Annie's holiday in the ${cruise} sea costs ${sum.toFixed(2)} lv.`)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement