Question: 1 Class Design In this step you must write the methods to complete a Bus class. Assume that the Passenger class has already been written

 1 Class Design In this step you must write the methods

1 Class Design In this step you must write the methods to complete a Bus class. Assume that the Passenger class has already been written Each bus has a capacity. A default constructor should initialize the capacity to 40, and another constructor should allow the programmer to specify any positive capacity An addPassenger (Passenger p) method should add the given Passenger object to the bus. Passengers can't be added if the bus is full. Hint: what new member variable is needed? A numberOfPassengers() method should return the current number of Passengers on board the bus

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!