Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions