You have a phone plan that lets you talk 180 minutes a day. Every day that you go over your daily limit you have to pay a fine of F = Men, where M is the number of minutes you went over and n is the number of days you have gone over (e.g if I went 20 minutes over the daily limit and it's my 2nd day going over, I have to pay 20*e2 = 147.78).
You will be given a list of 12-hour clock times. Even-indexed times represent the start of a phone call, odd-indexed times represent the end of a phone call. Using this list find out how much money the person has to pay in fines.
- Please use an approximation of e that is at least as accurate as 2.718
- You never need to round your answers or include a currency symbol.
- The first time in the list will always be an A.M (morning) time.
- Remember that in 12-hour time
12(you can think of
- A day starts at 12:00 AM and ends at 11:59 PM
- If a number is lower than the previous time, then that means that it is in the opposite (A.M./P.M) time range.
- A call will never start in one day and end in another.
10:30 2:30 5:30 6:30
This person made two phone calls in one day. One from 10:30 A.M. to 2:30 P.M., another from 5:30 P.M to 6:30 P.M. In total, they talked for 5 hours this day, going 120 minutes over the daily limit. Since it's their first offense, they have to pay 120*e =
$326.19 (yes, their phone plan is quite Draconic).
10:30 11:45 5:15 6:45 8:20 9:20 5:30 7:50 2:30 3:30
This person made several phone calls over 2 days. The first day they were on the phone from 10:30-11:45 A.M, 5:15-6:45 P.M., and 8:20-9:20 PM using a total of 225 minutes. That is an overage of 45 minutes. So their fine for the day is 45*e = $122.32.
The next day they talked from 5:30-7:50 A.M and 2:30-3:30 P.M., a total of 200 minutes. They went over by 20 minutes, and since it's their second offense they pay 20*e2 = $147.78
You output their total fee as $122.32 + $147.78 =
10:30 11:30 6:30 7:30 9:45 11:00 10:25 11:25 8:45 9:45 6:00 8:00 2:30 4:30
- Day 1:
- 10:30-11:30 A.M., 6:30-7:30 P.M., 9:45-11:00 P.M. = 195 minutes
- Fee: 15*e = $40.77
- Day 2:
- 10:25-11:25 A.M., 8:45-9:45 P.M. = 120 minutes
- Fee: $0
- Day 3:
- 6:00 - 8:00 A.M., 2:30-4:30 P.M. = 240 minutes
- Fee: 60*e2 = $443.34
Output: $40.77 + $0 + $443.34 =