Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function hotelRoom(month, nightsCount) {
- let priceStudio = 0;
- let priceApartment = 0;
- if (month === 'May' || month === 'October'){
- priceStudio = 50.00;
- priceApartment = 65.00;
- if (nightsCount > 7 && nightsCount <= 14){
- priceStudio = priceStudio * 0.95;
- } else if (nightsCount > 14){
- priceStudio = priceStudio * 0.7;
- }
- } else if (month === 'June' || month === 'September'){
- priceStudio = 75.20;
- priceApartment = 68.70;
- if (nightsCount > 14){
- priceStudio = priceStudio * 0.8;
- }
- } else if (month === 'July' || month === 'August'){
- priceStudio = 76.00;
- priceApartment = 77.00;
- }
- if (nightsCount > 14){
- priceApartment = priceApartment * 0.9;
- }
- let sumStudio = nightsCount * priceStudio;
- let sumApartment = nightsCount * priceApartment;
- console.log(`Apartment: ${sumApartment.toFixed(2)} lv.`);
- console.log(`Studio: ${sumStudio.toFixed(2)} lv.`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement