Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function smallShop(input) {
- let product = String(input[0]);
- let town = String(input[1]);
- let quantity = Number(input[2]);
- let sum = 0;
- if (town == "Sofia") {
- if (product == "coffee") {
- sum = quantity * 0.5;
- } else if (product == "water") {
- sum = quantity * 0.8;
- } else if (product == "beer") {
- sum = quantity * 1.2;
- } else if (product == "sweets") {
- sum = quantity * 1.45;
- } else if (product == "peanuts") {
- sum = quantity * 1.6;
- }
- } else if (town == "Plovdiv") {
- if (product == "coffee") {
- sum = quantity * 0.4;
- } else if (product == "water") {
- sum = quantity * 0.7;
- } else if (product == "beer") {
- sum = quantity * 1.15;
- } else if (product == "sweets") {
- sum = quantity * 1.30;
- } else if (product == "peanuts") {
- sum = quantity * 1.5;
- }
- } else if (town == "Varna") {
- if (product == "coffee") {
- sum = quantity * 0.45;
- } else if (product == "water") {
- sum = quantity * 0.7;
- } else if (product == "beer") {
- sum = quantity * 1.1;
- } else if (product == "sweets") {
- sum = quantity * 1.35;
- } else if (product == "peanuts") {
- sum = quantity * 1.55;
- }
- }
- console.log(sum);
- }
Add Comment
Please, Sign In to add comment