In a toll-booth at a bridge , some cars can pass by paying a tax of Rs. 10 and
some special vehicles are exempted from paying tax. The booth has to track
number of vehicles and total tax collected. Define a class ′tollbooth′. It should contain
two data items of type int to hold the number of cars and total tax connected.
A constructor initalizes these two variable to zero. A memberfunction freecar() only
increments the car total. Finally another memberfunction show() displays the
two totals.
Write a C++ program such that the user has to press the key ′T′ for
printing number of taxable cars and total tax, ′F′ for printing number of free
cars and ′Esc′ to exit.
|