Posted by: gwnurcahyo | January 22, 2010

Tugas OOP MKOM Angkatan 14

1. A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour in excess of three hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that will calculate and print the parking charges for each of 3 customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format, and should calculate and print the total of yesterday’s receipts. The program should use the function calculate-Charges to determine the charge for each customer. Your outputs should appear in the following format:
Car                                  Hours                                Charge
1                                         1.5                                       2.00
2                                        4.0                                       2.50
3                                      24.0                                    10.00
TOTAL                           29.5                                    14.50

2. Write a program that inputs a series of integers and passes then one at a time to function even which uses the modulus operator to determine if an integer is even. The function should take an integer argument and return 0 if the integer is even and 1 otherwise.
3. Write a function that returns the smallest of three floating-point numbers.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: