Advertisement
ggeorgiev88

zadacha 4

Nov 11th, 2022
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function transportPrice(input){
  2.     let kilometers = Number(input[0]);
  3.     let dayNigth = input[1];
  4.     let transportType = 0;
  5.     let tax = 0;
  6.    
  7.     if(kilometers < 20){
  8.         transportType === "taxi"
  9.        
  10.        
  11.     }
  12.     else if (dayNigth === "day"){
  13.         tax = 0.79
  14.        
  15.     }
  16.     else if (dayNigth === "night"){
  17.         tax = 0.9
  18.        
  19.     }
  20.  
  21.     if (kilometers > 21){
  22.         transportType === "autobus"
  23.         tax = 0.09
  24.        
  25.     }
  26.     if (kilometers > 100){
  27.         transportType === "train"
  28.         tax = 0.06
  29.        
  30.     }
  31.     console.log(`Take ${transportType},price of trip = ${(tax * kilometers).toFixed(2)}`)
  32.    
  33.     }
  34.  
  35.  
  36.  
  37. transportPrice(["33","day"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement