Advertisement
teofarov13

Untitled

Nov 13th, 2021
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function energyBooster(input) {
  2.     let fruit = input[0];
  3.     let size = input[1];
  4.     let count = Number(input[2]);
  5.     let price
  6.     //"Watermelon", "Mango", "Pineapple" или "Raspberry"
  7.     switch (size) {
  8.         case "small":
  9.             switch (fruit) {
  10.                 case "Watermelon": price = (2 * 56) * count; break;
  11.                 case "Mango": price = (2 * 36.6) * count; break;
  12.                 case "Pineapple": price = (2 * 42.10) * count; break;
  13.                 case "Raspberry": price = (2 * 20) * count; break
  14.             }break;
  15.         case "big":
  16.             switch (fruit) {
  17.                 case "Watermelon": price = (5 * 28.70) * count; break;
  18.                 case "Mango": price = (5 * 19.60) * count; break;
  19.                 case "Pineapple": price = (5 * 24.80) * count; break;
  20.                 case "Raspberry": price = (5 * 15.20) * count; break
  21.             }break;
  22.     }
  23.  
  24.     if (price >= 400 && price <= 1000) {
  25.         price *= 0.85;
  26.         console.log(`${price.toFixed(2)} lv.`);
  27.     } else if (price > 1000) {
  28.         price *= 0.50;
  29.         console.log(`${price.toFixed(2)} lv.`)
  30.     } else {
  31.         console.log(`${price.toFixed(2)} lv.`)
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement