Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fareEstimator(ride_time, ride_distance, cost_per_minute, cost_per_mile) {
- var cpm, rT, rD, cpmi, arr;
- rT = ride_time;
- rD = ride_distance;
- cpm = cost_per_minute;
- cpmi = cost_per_mile;
- arr = []
- for(var i in costPerMinute.length){ // two loops are not necessary as I only needed to increment both values at the same time
- var tRE,rE;
- tRE = rT * cpm[i] + rD * cpmi[i] ;
- rE = Math.round(tRE * 100)/100 ;
- arr.push(roundEst);
- };
- return arr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement