write a c++ program in which Imagine a tollbooth at a bridge. Cars passing by the booth are expected to pay a 50 Rs. Mostly they do, but sometimes a car goes by without paying. The tollbooth keeps...


write a c++ program in which


Imagine a tollbooth at a bridge. Cars passing by the booth are expected to pay a 50 Rs. Mostly they do, but sometimes a car goes by without paying. The tollbooth keeps track of the number of cars that have gone by, and of the total amount of money collected. Model this tollbooth with a class called tollBooth. The two data items are a type unsigned int to hold the total number of cars, and a type double to hold the total amount of money collected.
A constructor initializes both of these to 0. A member function called payingCar() increments the car total and adds 0.50 to the cash total. Another function, called nopayCar(), increments the car total but adds nothing to the cash total. Finally, a 2 members function called display() (using method overloading) displays the totals number of cars and total amount of money .
Include a program to test this class. This program should allow the user to push one key to count a paying car, and another to count a nonpaying car. Pushing the another key should cause the program to print out the total cars and total cash and then exit.
Note: use method overloading.
2. Create an employee class. The member data should comprise an int for storing the employee number and a float for storing the employee’s compensation. Member functions should allow the user to enter this data and display it. Write a main() that allows the user to enter data for three employees and display it.



Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here