Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function energyBooster(input) {
- let fruit = input[0];
- let size = input[1];
- let count = Number(input[2]);
- let price
- //"Watermelon", "Mango", "Pineapple" или "Raspberry"
- switch (size) {
- case "small":
- switch (fruit) {
- case "Watermelon": price = (2 * 56) * count; break;
- case "Mango": price = (2 * 36.6) * count; break;
- case "Pineapple": price = (2 * 42.10) * count; break;
- case "Raspberry": price = (2 * 20) * count; break
- }break;
- case "big":
- switch (fruit) {
- case "Watermelon": price = (5 * 28.70) * count; break;
- case "Mango": price = (5 * 19.60) * count; break;
- case "Pineapple": price = (5 * 24.80) * count; break;
- case "Raspberry": price = (5 * 15.20) * count; break
- }break;
- }
- if (price >= 400 && price <= 1000) {
- price *= 0.85;
- console.log(`${price.toFixed(2)} lv.`);
- } else if (price > 1000) {
- price *= 0.50;
- console.log(`${price.toFixed(2)} lv.`)
- } else {
- console.log(`${price.toFixed(2)} lv.`)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement