Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function smallShop(input){
- let product = input.shift();
- let town = input.shift();
- let quantity = Number(input.shift());
- let price = 0;
- if(town = "Sofia"){
- if(product = "cofee"){
- price = quantity * 0.50;
- } else if(product = "water"){
- price = quantity * 0.80;
- } else if(product = "beer"){
- price = quantity * 1.20;
- } else if(product = "sweets"){
- price = quantity * 1.45;
- } else if( product = "peanuts")
- price = quantity * 1.60;
- } else if(town = "Plovdiv"){
- if(product = "cofee"){
- price = quantity * 0.40;
- } else if(product = "water"){
- price = quantity * 0.70;
- } else if(product = "beer"){
- price = quantity * 1.15;
- } else if(product = "sweets"){
- price = quantity * 1.30;
- } else if( product = "peanuts")
- price = quantity * 1.50;
- } else if(town = "Varna"){
- if(product = "cofee"){
- price = quantity * 0.45;
- } else if(product = "water"){
- price = quantity * 0.70;
- } else if(product = "beer"){
- price = quantity * 1.10;
- } else if(product = "sweets"){
- price = quantity * 1.35;
- } else if( product = "peanuts")
- price = quantity * 1.55;
- } console.log(price)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement