Consider a toll plaza on a bridge. Cars passing through the toll plaza must pay a toll of Rs.30/-. Most of the time, they do, but every now and then, a car drives by without paying. The toll plaza records the number of cars that have passed through as well as the total amount of money collected. Model this toll-plaza with the help of the toll-plaza class. The class's two data items are to hold the total number of cars and to hold the total amount of money collected. For the c++ class, implement: A constructor that initializes both data items to 0. A member function called payingCar() increments the car total and adds 30 to the cash total. Another function, called nopayCar() that increments the car total but adds nothing to the cash total. Finally, a member function called display() should display the total cars and the total cash collected
Consider a toll plaza on a bridge. Cars passing through the toll plaza must pay a toll of Rs.30/-. Most of
the time, they do, but every now and then, a car drives by without paying. The toll plaza records the
number of cars that have passed through as well as the total amount of money collected.
Model this toll-plaza with the help of the toll-plaza class. The class's two data items are to hold the total
number of cars and to hold the total amount of money collected. For the c++ class, implement:
A constructor that initializes both data items to 0.
A member function called payingCar() increments the car total and adds 30 to the cash total.
Another function, called nopayCar() that increments the car total but adds nothing to the
cash total.
Finally, a member function called display() should display the total cars and the total cash
collected.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images