Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function easterTrip(input) {
- let destination = input[0];
- let booking = input[1];
- let nights = Number(input[2]);
- let price = 0;
- switch (destination) {
- case "France":
- if (booking === "21-23") {
- price = 30 * nights;
- } else if (booking === "24-27") {
- price = 35 * nights;
- } else {
- price = 40 * nights;
- }
- break;
- case "Italy":
- if (booking === "21-23") {
- price = 28 * nights;
- } else if (booking === "24-27") {
- price = 32 * nights;
- } else {
- price = 39 * nights;
- }
- break;
- case "Germany":
- if (booking === "21-23") {
- price = 32 * nights;
- } else if (booking === "24-27") {
- price = 37 * nights;
- } else {
- price = 43 * nights;
- }
- break;
- }
- console.log(`Easter trip to ${destination} : ${price.toFixed(2)} leva.`);
- }
Advertisement
Add Comment
Please, Sign In to add comment