Roshni Samala
| Subject: urgent help needed by many students of our class Wed Jan 07, 2009 9:23 pm | |
| this is the question given to us in the assignment programs which is very difficult for all the comp students.so please help.
Q.Imagine a tollbooth at a bridge.cars passing by the booth are expected to pay Rs.50/- toll.Mostly they do, but sometimes a car goes by without paying.The Tollbooth keeps a track of the number of cars that have gone by and of the total amout of money collected. Model this tollbooth with a class called Tollbooth. The 2 data items are integers to hold the total no. of cars and a type double to hold amount of money collected.a constuctor initializes both these to 0.A function called payingcar() increments the car total and adds Rs.50/- to the cash total .Another function called nonpayingcar() increments the car total. Finally a function calleddisplay(), displays the 2 totals.
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 non paying car. Pushing the ESC key should cause the program to print out the total cars and total cash and then exit. |
|