Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. function price(input) {
  2. let distance = Number(input.shift());
  3. let time = input[0];
  4.  
  5. if (distance < 20) {
  6.  
  7. if (time === "day") {
  8. var taxi = 0.70 + distance * 0.79;
  9. } else {
  10. taxi = 0.70 + distance * 0.90;
  11. }
  12. console.log(taxi.toFixed(2));
  13. } else if (distance >= 20 && distance < 100) {
  14. console.log((distance * 0.09).toFixed(2));
  15. } else {
  16. console.log((distance * 0.06).toFixed(2));
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement