Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. function fareEstimator(ride_time, ride_distance, cost_per_minute, cost_per_mile) {
  2.  
  3. var cpm, rT, rD, cpmi, arr;
  4.  
  5. rT = ride_time;
  6. rD = ride_distance;
  7. cpm = cost_per_minute;
  8. cpmi = cost_per_mile;
  9. arr = []
  10. for(var i in costPerMinute.length){ // two loops are not necessary as I only needed to increment both values at the same time
  11. var tRE,rE;
  12. tRE = rT * cpm[i] + rD * cpmi[i] ;
  13. rE = Math.round(tRE * 100)/100 ;
  14. arr.push(roundEst);
  15.  
  16.  
  17. };
  18.  
  19. return arr;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement