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