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