Advertisement
Liliana797979

fitness card

Dec 23rd, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function fitnessCard(arg1, arg2, arg3, arg4) {
  2.     let totalSum = Number(arg1);
  3.     let gender = arg2;
  4.     let age = Number(arg3);
  5.     let sport = arg4;
  6.     let students = "";
  7.     let money = 0;
  8.  
  9.     switch (gender) {
  10.         case "m":
  11.             switch (sport) {
  12.                 case "Gym":
  13.                     totalSum = 42;
  14.                 case "Boxing":
  15.                     totalSum = 41;
  16.                 case "Yoga":
  17.                     totalSum = 45;
  18.                 case "Zumba":
  19.                     totalSum = 34;
  20.                 case "Dances":
  21.                     totalSum = 51;
  22.                 case "Pilates":
  23.                     totalSum = 39;
  24.                     break;
  25.             }
  26.         case "f":
  27.             switch (sport) {
  28.                 case "Gym":
  29.                     totalSum = 35;
  30.                 case "Boxing":
  31.                     totalSum = 37;
  32.                 case "Yoga":
  33.                     totalSum = 42;
  34.                 case "Zumba":
  35.                     totalSum = 31;
  36.                 case "Dances":
  37.                     totalSum = 53;
  38.                 case "Pilates":
  39.                     totalSum = 37;
  40.                     break;
  41.             }
  42.             break;
  43.     }
  44.     if (age <= 19) {
  45.         totalSum = totalSum * 0.8;
  46.     } else {
  47.         totalSum;
  48.     }
  49.  
  50.     if (totalSum >= money) {
  51.         console.log(`You purchased a 1 month pass for ${sport}.`);
  52.  
  53.     } else {
  54.         console.log(`You don't have enough money! You need ${(money - totalSum).toFixed(2)} more.`);
  55.    }
  56. }
  57.  
  58. fitnessCard("20", "f", "15", "Yoga");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement