Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function hotelRoom(month, nights) {
- nights = Number(nights);
- let totalPriceApartment = 0;
- let totalPriceStudio = 0;
- if (month === "May" || month === "October") {
- studio = nights * 50;
- apartment = nights * 65;
- if (nights > 14) {
- totalPriceStudio = studio * 0.7;
- } else if (nights > 7) {
- totalPriceStudio = studio * 0.95;
- }
- } else if (month === "June" || month === "September") {
- studio = nights * 75.2;
- apartment = nights * 68.7;
- if (nights > 14) {
- totalPriceStudio = studio * 0.8;
- } else {
- totalPriceStudio = studio;
- }
- } else if (month === "July" || month === "August") {
- studio = nights * 76;
- apartment = nights * 77;
- totalPriceStudio = studio;
- }
- if (nights > 14) {
- totalPriceApartment = apartment * 0.9;
- } else {
- totalPriceApartment = apartment;
- }
- console.log(`Apartment: ${totalPriceApartment.toFixed(2)} lv.`);
- console.log(`Studio: ${totalPriceStudio.toFixed(2)} lv.`);
- }
- hotelRoom("August", "20");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement