Define the bus constructor to accept and initialize all


Design and implement a class called Bus that represents any bus route. It should contain instance data that represents the Bus Route Line, Number Of Stops on the line, and the Bus's starting point and final stop, the distance between each stop (assume the distance is the same), the speed of the bus, and the time spent at each stop. Define the Bus constructor to accept and initialize all instance data. Include getter and setter methods for all instance data. Create a method that calculates the time required to travel between the starting point and stopping point of the line based on a given speed.

Include a toString method that returns a one-line description of the Bus trip including bus line, number of stops, origin and destination stops, distance between the beginning and end of the line, and the time required to travel between the beginning and ending stops at a given speed and the number of stops. Create a driver class called BusTrip, whose main method instantiates and uses at least 3 Bus objects.

 

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Define the bus constructor to accept and initialize all
Reference No:- TGS0667842

Now Priced at $30 (50% Discount)

Recommended (90%)

Rated (4.3/5)