JAVASCRIPT // 07. Hotel Room // Judge points 60/100 //
function hotelRoom(input){
let month = input[0];
let nightClout = Number(input[1]);
let studioPrice = 0;
let apartmentPrice = 0;
switch (month) {
case 'May':
case 'October':
studioPrice = nightClout * 50.00;
apartmentPrice = nightClout * 65.00;
break;
case 'June':
case 'September':
studioPrice = nightClout * 75.20;
apartmentPrice = nightClout * 68.70;
break;
case 'July':
case 'August':
studioPrice = nightClout * 76.00;
apartmentPrice = nightClout * 77.00;
break;
}
if(month === 'May' || month === 'October'){
if(nightClout < 7){
studioPrice *= 0.95;
}else if(nightClout >= 14){
studioPrice *= 0.70;
apartmentPrice *= 0.90;
}
}else if(month === 'June' || month === 'September'){
if(nightClout < 14){
studioPrice *= 0.80;
}
}else if(nightClout > 14){
apartmentPrice *= 0.90;
}
console.log(`Apartment: ${apartmentPrice.toFixed(2)} lv.`);
console.log(`Studio: ${studioPrice.toFixed(2)} lv.`);
}