Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function hotelRoom(month, countNights) {
- countNights = Number(countNights);
- let studioPrice = 0;
- let apartment = 0;
- if ((month === "May") || (month === "October")) {
- studioPrice = 50 * countNights;
- apartment = 65 * countNights;
- if ((countNights > 7) && (countNights <= 14)) {
- studioPrice *= 0.95;
- } else if (countNights > 14) {
- studioPrice *= 0.7;
- }
- }
- if ((month === "June") || (month === "September ")) {
- studioPrice = 75.2 * countNights;
- apartment = 68.7 * countNights;
- if (countNights > 14) {
- studioPrice *= 0.8;
- }
- }
- if ((month === "July") || (month === "August")) {
- studioPrice = 76 * countNights;
- apartment = 77 * countNights;
- } if (countNights > 14) {
- apartment *= 0.9;
- }
- console.log(`Apartment: ${apartment.toFixed(2)} lv.`);
- console.log(`Studio: ${studioPrice.toFixed(2)} lv.`);
- }
Add Comment
Please, Sign In to add comment