Write C++ code for a class named MuniBus that has the following private member variables: int totalPassengers; double faresCollected; and the following public member functions: void passengerBoard() - adds 2.50 to faresCollected and adds 1 to totalPassengers double getFaresCollected() - returns faresCollected int getPassengers() - returns totalPassengers void reset() - sets totalPassengers and faresCollected to zero MuniBus() - default constructor. Initializes both totalPassengers and faresCollected to 0 MuniBus(int tp, double fc) - constructor which initializes totalPassengers to tp, faresCollected to fc ~MuniBus() - destructor. Prints out a message saying that the bus is being destroyed, and also prints out totalPassengers and faresCollected. Write the class declaration and implement all of the constructors, the destructor, and member functions. You do not need to demonstrate using your class or show output.
Write C++ code for a class named MuniBus that has the following private member variables:
int totalPassengers;
double faresCollected;
and the following public member functions:
void passengerBoard() - adds 2.50 to faresCollected and adds 1 to totalPassengers
double getFaresCollected() - returns faresCollected
int getPassengers() - returns totalPassengers
void reset() - sets totalPassengers and faresCollected to zero
MuniBus() - default constructor. Initializes both totalPassengers and faresCollected to 0
MuniBus(int tp, double fc) - constructor which initializes totalPassengers to tp, faresCollected to fc
~MuniBus() - destructor. Prints out a message saying that the bus is being destroyed, and also prints out totalPassengers and faresCollected.
Write the class declaration and implement all of the constructors, the destructor, and member functions. You do not need to demonstrate using your class or show output.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images