Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fitnessCard(arg1, arg2, arg3, arg4) {
- let totalSum = Number(arg1);
- let gender = arg2;
- let age = Number(arg3);
- let sport = arg4;
- let students = "";
- let money = 0;
- switch (gender) {
- case "m":
- switch (sport) {
- case "Gym":
- totalSum = 42;
- case "Boxing":
- totalSum = 41;
- case "Yoga":
- totalSum = 45;
- case "Zumba":
- totalSum = 34;
- case "Dances":
- totalSum = 51;
- case "Pilates":
- totalSum = 39;
- break;
- }
- case "f":
- switch (sport) {
- case "Gym":
- totalSum = 35;
- case "Boxing":
- totalSum = 37;
- case "Yoga":
- totalSum = 42;
- case "Zumba":
- totalSum = 31;
- case "Dances":
- totalSum = 53;
- case "Pilates":
- totalSum = 37;
- break;
- }
- break;
- }
- if (age <= 19) {
- totalSum = totalSum * 0.8;
- } else {
- totalSum;
- }
- if (totalSum >= money) {
- console.log(`You purchased a 1 month pass for ${sport}.`);
- } else {
- console.log(`You don't have enough money! You need ${(money - totalSum).toFixed(2)} more.`);
- }
- }
- fitnessCard("20", "f", "15", "Yoga");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement