Calculus I for Programmers
The car park till
A car park charges nothing for the first 15 minutes. After that you pay 1.50 for every hour or part hour you have been there, counted from the moment you arrived rather than from the end of the free period.
Write a function called charge that takes how many whole minutes a car has been in the car park and returns the amount owed, in pounds.
Part of an hour counts as a whole hour. Someone who stays 61 minutes has started a second hour and pays for two, even though the second hour is only a minute old.
Input: minutes = 61
Output: 3
Not free, since 61 is more than 15.
61 minutes is one whole hour plus one minute, so two hours
have been started. 2 started hours at 1.50 each is 3.00.Input: minutes = 16
Output: 1.5
Input: minutes = 0
Output: 0
The first is one minute past the free period, which starts
the first hour. The second never leaves the free period.minutes is between 0 and 1440.Run your code to see how it does on the examples. Submit also runs the hidden cases.