A hospital desires to computerize its daily parking activity. The parking opens its doors from 8 AM till 8 PM. Therefore; they bought a device to issue cards, at the entrance gate upon the visitor request, showing the arrival time. Upon leaving the parking the same card is inserted again in the same device by an employee at the exit door in order to send as input both the arrival and the leaving time to the computer. You are asked to write a C++ program that accepts as input the arrival time and leaving time as being two float numbers (for example, if the arrival time is 12:30, it will be inputted as 12.30 and using the built in function: floor(12.30) will result in the float value 12.0 on the other hand, if the departure time is 4:42, it will be inputted as 4.42 and using the built in function: ceil(4.42) will result in the float value 5.0 since any fraction of an hour will be charged as a full hour). These two floats are used to calculate the time spent inside the parking and to output the amount due with an additional 10% VAT tax. The rates are fixed as follows $5 for the first three hours and $2 for each additional hour. Your program must loop as long as the cahier wants to and must display at the end of the day the amount collected from all visitors.

3 Years
Discussion Span
Last Post by freeviewman
Featured Replies

Well. You need to create a class to hold each single transaction. It should have attributes cardNo, recordDateTime, inTime and outTime. In the set part of their accessors add the float() and cell() wrap the converted real time(you can either write a seprate converter or do it here).
Then you need a method countMoney() in which you apply the logic of money to hours (5 in 1st hour then 2 in rest) then return a value.
In main program body you need an event handler triggered by arrival time read. In that handler you use the class to hold and caculate values then remember them to DB, XML or text.
Then the rest job to do, collecting records base on their datetime then sum the result of countMoney().
You may or may not need to use List or ArrayList to make the collection.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.