Advertisement
ShadowEmbrace

Fitness Rates

Jan 22nd, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(day, service, time) {
  2.     let week = true;
  3.     let money = 0;
  4.  
  5.     function dayOfWeek(day) {
  6.         switch (day) {
  7.             case 'Monday': return week = true; break;
  8.             case 'Tuesday': return week = true; break;
  9.             case 'Wednesday': return week = true; break;
  10.             case 'Thursday': return week = true; break;
  11.             case 'Friday': return week = true; break;
  12.             case 'Saturday': return week = false; break;
  13.             case 'Sunday': return week = false; break;
  14.         }
  15.     }
  16.  
  17.     if (service === 'Fitness') {
  18.         if (dayOfWeek(day)) {
  19.             if (time >= 8 && time <= 15) {
  20.                 money = 5;
  21.             } else {
  22.                 money = 7.5;
  23.             }
  24.         } else {
  25.             money = 8;
  26.         }
  27.     }else if  (service === 'Sauna') {
  28.         if (dayOfWeek(day)) {
  29.             if (time >= 8 && time <= 15) {
  30.                 money = 4;
  31.             } else {
  32.                 money = 6.5;
  33.             }
  34.         } else {
  35.             money = 7;
  36.         }
  37.     }else if  (service === 'Instructor') {
  38.         if (dayOfWeek(day)) {
  39.             if (time >= 8 && time <= 15) {
  40.                 money = 10;
  41.             } else {
  42.                 money = 12.5;
  43.             }
  44.         } else {
  45.             money = 15;
  46.         }
  47.     }
  48.  
  49.     return money;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement