BlueBook - Bills Bills Bills

View as PDF

Submit solution

Points: 7
Time limit: 1.0s
Memory limit: 16M

Problem types
BlueBook

A gas company has a monthly billing rate based on the total gas consumption by its customers. The charge varies according to the meter reading (m3). The rate structure is as follows:

Total Consumption Total Charge
For the first 10m3 or less $6.59 (minimum bill)
For the next 20m3 23.73 cents/m3
For the next 55m3 22.71 cents/m3
For the next 85m3 21.78 cents/m3
For the next 170m3 or above 20.85 cents/m3

Note: There are situations where the final reading may be less than the initial reading. For example, the initial reading might be 9980 while the final reading is 0015, indicating a consumption during the month of 35m3 because the meter has 'rolled over'.

Input Specification

For each customer, the program should read an account number 0 \le A \le 99\,999 and two meter readings 0 \le M_1, M_2 < 10\,000. M_1 represents the reading at the beginning of the month while M_2 represents the reading at the beginning of the next month. The first line of input will be the account number. The second line of input will be M_1 followed by a space then M_2. The input will be terminated if and only if a negative account number is entered.

Output Specification

For each customer, your program should re-output the customer's account number and then on a new line output the final charge in dollars rounded off to two decimal places.

Sample Input

34567
0000 0005
12345
0000 0015
-1

Sample Output

Account #: 34567
Bill: 6.59
Account #: 12345
Bill: 7.78

Comments

There are no comments at the moment.