Problem Statement
You have spoken seconds seconds by phone and you'd like to calculate the cost of the call. Starting a call always costs you 5 cents, regardless of the call's duration. Additionally, you need to pay for every minute you've been talking. Any fractional minute is charged at full price, so if you've talked for 65 seconds, you'll be charged for 2 minutes. Also, the timer for a new minute starts when your 60-th, 120-th, 180-th, ... second ends (if you talk for 120 seconds, you'll be charged for 3 minutes).
The payment for the call itself is a bit complicated. During the first 5 minutes of the call, you must pay 10 cents for each minute that you've talked. After the first 5 minutes of the call, each additional minute will cost you only 3 cents. Given the duration of your call in seconds, return the cost of the call.
Definition
- Class:
- CellularPhoneTarif
- Method:
- calculatePrice
- Parameters:
- int
- Returns:
- int
- Method signature:
- int calculatePrice(int seconds)
- (be sure your method is public)
Constraints
- seconds will be between 0 and 10000, inclusive.
Examples
65
Returns: 25
300
Returns: 58
100
Returns: 25
0
Returns: 15
10000
Returns: 541
313
Returns: 58
58
Returns: 15
2
Returns: 15
2933
Returns: 187
121
Returns: 35
302
Returns: 58
118
Returns: 25
239
Returns: 45
180
Returns: 45
8744
Returns: 478
602
Returns: 73
722
Returns: 79
1410
Returns: 112
5008
Returns: 292
5929
Returns: 337
7745
Returns: 430
841
Returns: 85
241
Returns: 55
1201
Returns: 103
301
Returns: 58
61
Returns: 25
1260
Returns: 106
1381
Returns: 112
1
Returns: 15
1201
Returns: 103
1436
Returns: 112
1320
Returns: 109
1199
Returns: 100
6289
Returns: 355
1678
Returns: 124
1022
Returns: 94
1570
Returns: 121
360
Returns: 61
598
Returns: 70
1621
Returns: 124
763
Returns: 79
1065
Returns: 94
1919
Returns: 136
1021
Returns: 94
842
Returns: 85
358
Returns: 58
602
Returns: 73
6730
Returns: 379
1559
Returns: 118
2339
Returns: 157
1861
Returns: 136
900
Returns: 88
301
Returns: 58
240
Returns: 55
0
Returns: 15
59
Returns: 15