Question: The Car / Truck / Bus / Motorcycle class allow us to make every car into an independent object. Each vehicle should be able to
The CarTruckBusMotorcycle class allow us to make every car into an independent object. Each
vehicle should be able to move, erase, and display itself. To do this it needs access to the two
Place objects that represent its position. These cannot be member data of the vehicle object we
need to use only reference to the Place objects that are part of the Road. As the vehicle moves, it
unblocks the Place in the rear and blocks the Place ahead. Vehicle can also collect statistics about
itself the total time on the road, the waiting time, the distance traveled, etc. We see that a vehicle
designed this way has no knowledge of the world around it other than its position on the road, the
direction of travel, and whether the place ahead is free.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
