Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function exam(input) {
  2.     let kindCruise = input[0];
  3.     let kindKauta = input[1];
  4.     let nights = Number(input[2]);
  5.  
  6.     if (kindCruise == `Mediterranean`) {
  7.         if (kindKauta == `standard cabin`) {
  8.             tax = 27.50
  9.         } else if (kindKauta == `cabin with balcony`) {
  10.             tax = 30.20
  11.         } else if (kindKauta == `apartment`) {
  12.             tax = 40.50
  13.         }
  14.     } if (kindCruise == `Adriatic`) {
  15.         if (kindKauta == `standard cabin`) {
  16.             tax = 22.99
  17.         } else if (kindKauta == `cabin with balcony`) {
  18.             tax = 25.00
  19.         } else if (kindKauta == `apartment`) {
  20.             tax = 34.99
  21.         }
  22.     } if (kindCruise == `Aegean`) {
  23.         if (kindKauta == `standard cabin`) {
  24.             tax = 23.00
  25.         } else if (kindKauta == `cabin with balcony`) {
  26.             tax = 26.60
  27.         } else if (kindKauta == `apartment`) {
  28.             tax = 39.80
  29.         }
  30.     }
  31.  
  32.     let allNights = tax * 4 * nights
  33.  
  34.     if (nights > 7) {
  35.         allNights = allNights * 0.75
  36.     }
  37.  
  38.  
  39.     console.log(`Annie's holiday in the ${kindCruise} sea costs ${allNights.toFixed(2)} lv.`)
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement