Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started