The Fee
How much does the parking cost? The garage's prices are in new variables: hour_price is the price of every started hour, 2 EUR, and daily_max is the most that a car pays, 10 EUR, even if it stays all day. Parking is free on Sundays, and so is parking for at most free_minutes: a car that leaves after 15 minutes or less pays nothing. The variable day says which day of the week it is, from 1 (Monday) to 7 (Sunday). Today is Wednesday.
Add the fee below what the program already prints. For our car, the whole output is:
Parked: 2 h 25 min
Started hours: 3
Fee: 6 EURWhen the parking is free, the program prints Fee: free. The exercise also tries a car that stays from 7:50 to 18:15: 11 started hours would cost 22 EUR, but it pays only 10, so the program prints Fee: 10 EUR.
Instructions
Print the fee. When the parking is free, print Fee: free.
Make sure that no car pays more than daily_max.
Start programming for free
2/3