Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function hotelRoom(input) {
- let month = input[0];
- let nights = Number(input[1]);
- priceStudio = 0;
- priceApartment = 0;
- if (month === "May" || month === "October") {
- priceApartment = 65 * nights;
- priceStudio = 50 * nights;
- if (nights > 7 && nights <= 14) {
- priceStudio = priceStudio * 0.95;
- } else if (nights > 14) {
- priceStudio = priceStudio * 0.70;
- priceApartment = priceApartment * 0.90;
- }
- } else if (month === "June" || month === "September") {
- priceApartment = 68.70 * nights;
- priceStudio = 75.20 * nights;
- if (nights > 14) {
- priceStudio = priceStudio * 0.80;
- priceApartment = priceApartment * 0.90;
- }
- } else if (month === "July" || month === "August") {
- priceApartment = 77 * nights;
- priceStudio = 76 * nights;
- if (nights > 14) {
- priceApartment = priceApartment * 0.90;
- }
- }
- console.log(`Apartment: ${priceApartment.toFixed(2)} lv.`);
- console.log(`Studio: ${priceStudio.toFixed(2)} lv.`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement