Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(month, overNightNumber) {
- overNightNumber = Number(overNightNumber);
- let studioPricePerNight;
- let apratmentPricePerNight;
- let studioPrice;
- let apartmentPrice;
- if (month === 'May' || month === 'October') {
- studioPricePerNight = 50;
- apratmentPricePerNight = 65;
- studioPrice = overNightNumber * studioPricePerNight;
- apartmentPrice = overNightNumber * apratmentPricePerNight;
- if (overNightNumber >= 7) {
- studioPrice = studioPrice - studioPrice * 0.05;
- } else if (overNightNumber >= 14) {
- studioPrice = studioPrice - studioPrice * 0.3;
- }
- } else if (month === 'June' || month === 'September') {
- studioPricePerNight = 75.20
- apratmentPricePerNight = 68.70
- studioPrice = overNightNumber * studioPricePerNight;
- apartmentPrice = overNightNumber * apratmentPricePerNight;
- if (overNightNumber >= 14) {
- studioPrice = studioPrice - studioPrice * 0.2;
- }
- } else if (month === 'July' || month === 'August') {
- studioPricePerNight = 76;
- apratmentPricePerNight = 77;
- studioPrice = overNightNumber * studioPricePerNight;
- apartmentPrice = overNightNumber * apratmentPricePerNight;
- }
- if (overNightNumber >= 14) {
- apartmentPrice = apartmentPrice - apartmentPrice * 0.1;
- }
- console.log(`Apartment: ${apartmentPrice.toFixed(2)} lv.`);
- console.log(`Studio: ${studioPrice.toFixed(2)} lv.`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement