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