Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sushi(input){
  2.  
  3.     let product = input.shift();
  4.     let restaurant = input.shift();
  5.     let count = +input.shift();
  6.     let orders = input.shift();
  7.  
  8.     let price = 0;
  9.     let totalPrice = 0;
  10.  
  11.     if(restaurant === `Sushi Zone`){
  12.         if(product === `sashimi`){
  13.             price = count * 4.99;
  14.         }
  15.         else if(product === `maki`){
  16.             price = count * 5.29;
  17.  
  18.         }
  19.         else if(product === `uramaki`){
  20.             price = count * 5.99;
  21.  
  22.         }
  23.         else if(product === `temaki`){
  24.             price = count * 4.29;
  25.         }
  26.  
  27.         if(orders === `Y`){
  28.             totalPrice = price * 1.2;
  29.         }
  30.         else{
  31.             totalPrice = price;
  32.         }
  33.         console.log(`Total price: ${Math.ceil(totalPrice)} lv.`);
  34.     }
  35.     else if(restaurant === `Sushi Time`){
  36.         if(product === `sashimi`){
  37.             price = count * 5.49;
  38.         }
  39.         else if(product === `maki`){
  40.             price = count * 4.69;
  41.         }
  42.         else if(product === `uramaki`){
  43.             price = count * 4.49;
  44.  
  45.         }
  46.         else if(product === `temaki`){
  47.             price = count * 5.19;
  48.         }
  49.  
  50.         if(orders === `Y`){
  51.             totalPrice = price * 1.2;
  52.         }
  53.         else{
  54.             totalPrice = price;
  55.         }
  56.         console.log(`Total price: ${Math.ceil(totalPrice)} lv.`);
  57.     }
  58.     else if(restaurant === `Sushi Bar`){
  59.         if(product === `sashimi`){
  60.             price = count * 5.25;
  61.         }
  62.         else if(product === `maki`){
  63.             price = count * 5.55;
  64.  
  65.         }
  66.         else if(product === `uramaki`){
  67.             price = count * 6.25;
  68.  
  69.         }
  70.         else if(product === `temaki`){
  71.             price = count * 4.75;
  72.         }
  73.  
  74.         if(orders === `Y`){
  75.             totalPrice = price * 1.2;
  76.         }
  77.         else{
  78.             totalPrice = price;
  79.         }
  80.         console.log(`Total price: ${Math.ceil(totalPrice)} lv.`);
  81.     }
  82.     else if(restaurant === `Asian Pub`){
  83.         if(product === `sashimi`){
  84.             price = count * 4.5;
  85.         }
  86.         else if(product === `maki`){
  87.             price = count * 4.8;
  88.  
  89.         }
  90.         else if(product === `urаmaki`){
  91.             price = count * 5.5;
  92.  
  93.         }
  94.         else if(product === `temaki`){
  95.             price = count * 5.5;
  96.         }
  97.  
  98.         if(orders === `Y`){
  99.             totalPrice = price * 1.2;
  100.         }
  101.         else{
  102.             totalPrice = price;
  103.         }
  104.         console.log(`Total price: ${Math.ceil(totalPrice)} lv.`);
  105.     }
  106.     else{
  107.         console.log(`${restaurant} is invalid restaurant!`);
  108.     }
  109. }
  110. sushi([`sashimi`,`Sushi Time`,`3`,`N`])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement