Advertisement
Liliana797979

energy booster

Dec 22nd, 2020
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function energyBooster(arg1,arg2, arg3) {
  2.     let fruit = arg1;
  3.     let setSize = arg2;
  4.     let setCount = Number(arg3);
  5.     let totalPrice = 0;
  6.  
  7.     switch (fruit) {
  8.         case "Watermelon":
  9.             switch (setSize) {
  10.                 case "small":
  11.                     totalPrice = setCount * (56 * 2);
  12.                 case "big":
  13.                     totalPrice = setCount * (28.70 * 5);
  14.                     break;
  15.             }
  16.         case "Mango":
  17.             switch (setSize) {
  18.                 case "small":
  19.                     totalPrice = setCount * (36.66 * 2);
  20.                 case "big":
  21.                     totalPrice = setCount * (19.60 * 5);
  22.                     break;
  23.             }
  24.         case "Pineapple":
  25.             switch (setSize) {
  26.                 case "small":
  27.                     totalPrice = setCount * (42.10 * 2);
  28.                 case "big":
  29.                     totalPrice = setCount * (24.80 * 5);
  30.                     break;
  31.             }
  32.         case "Raspberry":
  33.             switch (setSize) {
  34.                 case "small":
  35.                     totalPrice = setCount * (20 * 2);
  36.                 case "big":
  37.                     totalPrice = setCount * (15.20 * 5);
  38.                     break;
  39.             }
  40.             break;
  41.     }
  42.  
  43.     if (totalPrice > 400 && totalPrice <= 1000) {
  44.         totalPrice = totalPrice * 0.85;
  45.     } else if (totalPrice > 1000) {
  46.         totalPrice = totalPrice * 0.50;
  47.     }
  48.     console.log(`${(totalPrice).toFixed(2)}`);
  49. }
  50.  
  51. energyBooster("Watermelon", "big", "4");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement