Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function energyBooster(arg1,arg2, arg3) {
- let fruit = arg1;
- let setSize = arg2;
- let setCount = Number(arg3);
- let totalPrice = 0;
- switch (fruit) {
- case "Watermelon":
- switch (setSize) {
- case "small":
- totalPrice = setCount * (56 * 2);
- case "big":
- totalPrice = setCount * (28.70 * 5);
- break;
- }
- case "Mango":
- switch (setSize) {
- case "small":
- totalPrice = setCount * (36.66 * 2);
- case "big":
- totalPrice = setCount * (19.60 * 5);
- break;
- }
- case "Pineapple":
- switch (setSize) {
- case "small":
- totalPrice = setCount * (42.10 * 2);
- case "big":
- totalPrice = setCount * (24.80 * 5);
- break;
- }
- case "Raspberry":
- switch (setSize) {
- case "small":
- totalPrice = setCount * (20 * 2);
- case "big":
- totalPrice = setCount * (15.20 * 5);
- break;
- }
- break;
- }
- if (totalPrice > 400 && totalPrice <= 1000) {
- totalPrice = totalPrice * 0.85;
- } else if (totalPrice > 1000) {
- totalPrice = totalPrice * 0.50;
- }
- console.log(`${(totalPrice).toFixed(2)}`);
- }
- energyBooster("Watermelon", "big", "4");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement