Question: NOTE: I need this completed in C++ formatting, please. Background : Monthly natural gas billing amounts for a certain city are calculated using various quantities
NOTE: I need this completed in C++ formatting, please.
Background: Monthly natural gas billing amounts for a certain city are calculated using various quantities and rates which are available on the billing statement. Several related terms and charges are defined below:
Basic Charge = $8.00 (this fee is charged regardless of the energy usage)
Number of days in the billing period = Final Date - Initial Date (from 26 to 35 days)
Initial meter reading, Final meter reading = 5 digit meter readings in CCF (100 cubic feet)
Gas Used = Final meter reading - Initial meter reading (add 100000 if negative) - see note below
Gas Cost = (Up to 35 CCF of gas used)*(37.74/CCF) = cost for up to 35 CCF
= (Gas used over 35 CCF)*(34.858/CCF) cost for the amount used over 35 CCF
Utility Tax = $2.40 (this fee is charged regardless of the energy usage)
Late Penalty = 1.5% of the previous months bill (before taxes) if it was paid late
Average Daily Cost = Bill Amount before taxes and not including late penalties
Number of days in the billing period
Note: the reading on the meter displays 5 digits, so the meter counts 99998, 99999, 00000, etc. So if the final meter reading is less than the initial reading (or if the Gas Used is negative), 100000 must be added.
Example:
Initial Date: May 7
Final Date: June 5
Number of days in the billing period = 29
Previous months Bill: $42.67 (paid late)
Initial meter reading = 01699 CCF
Final meter reading = 01772 CCF
Gas Used = Final meter reading - Initial meter reading = 01772 - 01699 = 73 CCF
Cost summary: Basic Charge $8.00
Gas Cost = (35 CCF)(37.74/CCF) + (38 CCF)(34.858/CCF) = $26.46
Subtotal $34.46
Late Payment Charge ($42.67)(0.015) .64
Utility Tax $2.40
Total Current Charges $37.50
Average daily cost ($34.46/29 days) $1.19
Page 2
Program Requirements:
1. The program should display a descriptive program title initially and then request the following information from the user:
Initial Date (Month and Day - for example, enter 6 7 for June 7)
Final Date
Initial meter reading
Final meter reading
Was last months bill paid late? If so, enter the amount.
2. Check for improper inputs. If an improper input is entered, display an error message and terminate the program (return 1 in the main program). Be sure to check for the following:
a valid date must be entered
initial and final meter readings must be between 00000 and 99999
if the user enters the amount for the last months bill, it must be positive
the number of days in the billing cycle must be from 26 to 35
3. The output should display the following information as a minimum (with appropriate units and formatting): (even though information was entered, it still needs to be reprinted in a nice format
Initial Date (using month name and day)
Final Date (using month name and day
Number of days in the billing period
Initial meter reading (leading 0s must be displayed)
Final meter reading (leading 0s must be displayed)
Gas Used
Amount of previous bill (only if paid late)
Late charge (if applicable)
Utility tax
Cost before tax
Total current charges
Average daily cost
5. Run your program for at least the following cases and include printed results for each case in your report.
| Initial meter reading (CCF) | Final meter reading (CCF) | Initial Date | Final Date | Last months bill late? | If late, amount was |
| 01699 | 01772 | May 7 | June 5 | Yes | $42.67 |
| 99956 | 00088 | October 2 | October 30 | No |
|
| 99933 | 99966 | July 17 | August 20 | No |
|
| 99912 | 00001 | June 30 | August 2 | No |
|
| 76990 | 77599 | February 8 | March 9 | Yes | $53.25 |
Note: Case 1 above is the same example as shown on page 1. Your results should match.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
