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
301
Returns: 58
240
Returns: 55