Advertisement
vladovip

Orders of Food

Feb 7th, 2021
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function foodTotalPrice(productType, quantity, ) {
  2.    
  3.     let foodTotalPrice = 0 ;
  4.     let product = productType.toString();
  5.  
  6.     switch (product) {
  7.  
  8.         case 'coffee':
  9.            foodTotalPrice =  quantity * 1.50;
  10.             break;
  11.         case 'coke':
  12.             foodTotalPrice =  quantity * 1.40;
  13.             break;
  14.         case 'water':
  15.             foodTotalPrice =  quantity * 1.00;
  16.             break;
  17.         case 'snacks':
  18.             foodTotalPrice = quantity * 2.00;
  19.             break;
  20.     }
  21.  
  22.     console.log(foodTotalPrice.toFixed(2));
  23. }
  24. foodTotalPrice( 'water' , 5);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement