Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function exam(input) {
- let kindCruise = input[0];
- let kindKauta = input[1];
- let nights = Number(input[2]);
- if (kindCruise == `Mediterranean`) {
- if (kindKauta == `standard cabin`) {
- tax = 27.50
- } else if (kindKauta == `cabin with balcony`) {
- tax = 30.20
- } else if (kindKauta == `apartment`) {
- tax = 40.50
- }
- } if (kindCruise == `Adriatic`) {
- if (kindKauta == `standard cabin`) {
- tax = 22.99
- } else if (kindKauta == `cabin with balcony`) {
- tax = 25.00
- } else if (kindKauta == `apartment`) {
- tax = 34.99
- }
- } if (kindCruise == `Aegean`) {
- if (kindKauta == `standard cabin`) {
- tax = 23.00
- } else if (kindKauta == `cabin with balcony`) {
- tax = 26.60
- } else if (kindKauta == `apartment`) {
- tax = 39.80
- }
- }
- let allNights = tax * 4 * nights
- if (nights > 7) {
- allNights = allNights * 0.75
- }
- console.log(`Annie's holiday in the ${kindCruise} sea costs ${allNights.toFixed(2)} lv.`)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement