Projects


Collection of Projects for C / C++ language

1 comments:

Anonymous said...

can you help my programming project ? here's the problem.

write a flowchart and C program to calculate the parking fare for customers who park their cars in a parking lot when the following information is given:

a. a character showing the type of vehicle: C for car, B for bus, T for truck.
b. an integer between 0 and 24 showing the hour the vehicle entered the lot.
c. an integer between 0 and 60 showing the minute the vehicle entered the lot.
d. an integer between 0 to 24 showing the hour the vehicle left the lot.
e. an integer between 0 and 69 showing the minute the vehicle left the lot.

vehicle type first rate second rate
car 0.00/HR first 3 HR 25.50/HR after 3 hr
truck 15.00/HR first 2 HR 35.75/HR after 2 Hr
bus 25.00/HR first 1 HR 43.40/HR after 1st hour

final output
TYPE OF VEHICLE: CAR/BUS/TRUCK
TIME IN: XX:XX
TIME OUT: XX:XX
PARKING TIME: XX:XX
ROUNDED TOTAL: XX:XX
TOTAL CHARGE: XX:XX
No vehicle is allowed to stay in the parking lot later than midnight; it will be tawed away.

The input data consist of a character and a set of four integers representing the
type of vehicle and the entering and leaving hours and minutes. But these
pieces of data must be input into the computer in a user-friendly way. In other
words, the computer must prompt the user to enter each piece of data as show
below. (Note: Red colour indicates typical data)

Type of vehicle? C
Hour vehicle entered lot (0-24)? 14
Minute vehicle entered lot (0-60)? 23
Hour vehicle left lot (0-24)? 18
Minute vehicle left lot (0-60)? 8

The output format is shown below:
This program must first calculate the actual time spent in the parking lot for
each vehicle. You may use the following algorithm:

a) Compare the minute portion of the leaving and the entering time. If the first
one is smaller than the second,
- Add 60 to the minute portion of the leaving time
- Subtract 1 from the hour portion of the leaving time
B) Subtract the hour portions
c) Subtract the minute portions
d) Since there are no fractional hour charges, the program must also round the
parking time up to the next hour before calculating the charge. The program
should use switch statement to distinguish between the different types of
vehicles

Post a Comment