Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function hotelRoom(month, night) {
- month = month;
- night = +(night);
- let studio = 0;
- let apartment = 0;
- switch (month) {
- case "May": studio = 50; apartment = 65; break;
- case "October": studio = 50; apartment = 65; break;
- case "June": studio = 75.20; apartment = 68.70; break;
- case "September": studio = 75.20; apartment = 68.70; break;
- case "July": studio = 76; apartment = 77; break;
- case "August": studio = 76; apartment = 77; break;
- }
- if ((night > 14) && (month == "May" || month == "October")) {
- studio *= 0.70;
- }
- if ((night > 14) && (month == "June" || month == "September")) {
- studio *= 0.80;
- }
- if ((night > 7 && night <= 14) && (month == "May" || month == "October")) {
- studio *= 0.95;
- }
- if (night > 14) {
- apartment *= 0.90;
- }
- let priceStudio = (night * studio).toFixed(2);
- let priceApartment = (night * apartment).toFixed(2);
- console.log(`Apartment: ${priceApartment} lv.`)
- console.log(`Studio: ${priceStudio} lv.`)
- }
- hotelRoom("May", 15);
- hotelRoom("June", 14);
- hotelRoom("August", 20);
- function onTimeForExam(hourExam, minExam, hourSchool, minSchool) {
- hourExam = +(hourExam);
- minExam = +(minExam);
- hourSchool = +(hourSchool);
- minSchool = +(minSchool);
- let examInMins = hourExam * 60 + minExam;
- let arrivalMins = hourSchool * 60 + minSchool;
- let diff = examInMins - arrivalMins;
- if (diff < 0) {
- console.log("Late");
- if (diff > -60) {
- console.log(`${Math.abs(diff)} minutes after the start`);
- }
- else {
- let hours = (Math.floor(Math.abs(diff) / 60));
- let min = Math.abs(diff % 60);
- if (min < 10) {
- console.log(`${hours}:0${min} hours after the start`);
- }
- else {
- console.log(`${hours}:${min} hours after the start`);
- }
- }
- }
- else if (diff <= 30) {
- console.log("On Time");
- if (diff > 0) {
- console.log(`${diff} minutes before the start`);
- }
- }
- else
- {
- console.log("Early");
- if (diff < 60) {
- console.log(`${diff} minutes before the start`);
- }
- else
- {
- let hours = Math.floor(diff / 60);
- let min = diff % 60;
- if (min < 10) {
- console.log(`${hours}:0${min} hours before the start`);
- }
- else {
- console.log(`${hours}:${min} hours before the start`);
- }
- }
- }
- }
- onTimeForExam(9, 30, 10, 50);
- onTimeForExam(9, 00, 8, 30);
- onTimeForExam(16, 00, 15, 00);
- onTimeForExam(9, 00, 9, 00);
- function volleyball(year, p, h) {
- year = (year);
- p = +(p);
- h = +(h);
- let weekend = 48;
- let sofiaWeekendDay = (48 - h) * 3 / 4;
- let townWeekendDay = h ;
- let playHoliday = (p * 2) / 3;
- let playWeekend = sofiaWeekendDay + townWeekendDay;
- if (year === "leap") {
- playHoliday *= 1.15;
- playWeekend *= 1.15;
- }
- console.log(Math.floor(playHoliday + playWeekend));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement