1. Engineering
  2. Computer Science
  3. part 4 planning your route now that youve worked out...

Question: part 4 planning your route now that youve worked out...

Question details

Part 4: Planning your route Now that youve worked out a system for estimating travel distances and ride fares, youre ready to start testing your new rideshare service. You fire up your fancy new program and immediately get three simultaneous rider requests, but luckily they all are looking for a ride to the same place the airport! You plan on picking up all three passengers on the same trip so that you can drop them all off at the same time. You want to take the shortest possible route so that you minimize the cost of gas and, in turn, the amount of money the trip costs you! The challenge: You need to create a function that takes in a starting position, a list of three rider locations, and a stopping location and determines the order of rider pickups that will require the least amount of driving. You want to make the default stopping location be the airport, since you figure this is where people will be headed most often. You should be able to use your function for computing the Lyft distance to help solve this problem. Work out a plan for your function on the whiteboards first! You may need to draw a diagram to figure out how to solve this. Once youve come up with a plan, try writing the function. The function should return the list of rider locations in the appropriate pick-up order and the total distance of the trip. Lets assume that: 1. Your starting location is (-2,3) 2. The ride locations are (1, -2), (3,3), and (2 -1). 3. The stopping location, the airport, is at (4,0) :Put your code here
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution