Simulate a car sharing system in which car commuters pick up and drop off passengers at designated

Question:

Simulate a car sharing system in which car commuters pick up and drop off passengers at designated stations. Assume that there are 30 such stations, one at every mile along a route. At each station, randomly generate a number of cars and passengers, each of them with a desired target station.

Each driver picks up three random passengers whose destination is on the way to the car’s destination, drops them off where requested, and picks up more if possible. A driver gets paid per passenger per mile. Run the simulation 1,000 times and report the average revenue per mile.

Use classes Car, Passenger, Station, and Simulation in your solution.

••

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question

Big Java, Enhanced Early Objects

ISBN: 9781119499091

7th Edition

Authors: Cay S Horstmann

Question Posted: