Question: The programming language is C++ The billing record is below: John H. Doe 1001 H 5693.3 James Randolph, Jr. 3333 H 1000.0 Sara Lawrence-Smith 2456
The programming language is C++
The billing record is below:
John H. Doe 1001 H 5693.3
James Randolph, Jr. 3333 H 1000.0
Sara Lawrence-Smith 2456 H 3999999.5
Good Time Industries 4678 C 10000000.1
Big Business, Inc. 6757 I 12500849.9
Mom and Pop Shop 5002 C 4000000.7
The O'Leary Company 8022 I 9999999.9




Write a program that will produce a monthly billing report for the local water company The water rates vary, depending on the type of customer and how the water is used. The company uses letter codes to identify the following types of customers H for home, C for commercial, and I for industrial The water rates are computed as follows Code H: $25.00 plus $0.00325 per gallon used Code C: $1,200.00 if usage does not exceed 4 million gallons; if usage exceeds 4 million gallons charge $1,200.00 plus $0.00525 for each additional gallon over 4 million Code l: $2500.00 if usage does not exceed 4 million gallons; $3500.00 if usage exceeds 4 million gallons but does not exceed 10 million gallons; and $5000.00 if usage exceeds 10 million gallons The account records for each month are stored in a text file. For each account the following data items are stored on one line and separated by a tab character customer name, account number, account type code (H, C or I) and the amount of water used Specifications for Program 1. Use named constants for all usage limits and rates found above, all alert values found below (I count 10 items) and the column widths required for the output report as these are all subject to future change. Apply your knowledge of scope to place these identifiers in the appropriate scope (where needed) based on your program design. Be certain total of column widths does not exceed 80 Input Data: (raw data read from a file created in PA7) 2. Customer Name: Account Number: Account Type Usage Amount: multiword string class object (allow maximum of twenty characters) integer in the range 1000 to 9999 character H, C, or floating point value of type double Output Information: (written to a file in report format) Amount Due: floating point value of type double - will create a function to calculate The main function: the input data record file and the output report file will be defined, opened and closed in main and the program will iterate until the end of the input file is reached. Use string class objects (variables) to store the file names. After they are created, add the I/O files to the project Solution Explorer as Resource Files a. In PA7 your program created a Water Bill Records.txt file to hold the account data. This will be the input 3. record file for this program so after creating your PA8 project, copy this file from PA7 to PA8 and add it to your project. Be certain that the EOF is on the line following the last record Defining and Opening input record file: Opening a file for reading (input) is similar to opening one for writing, however you will need to define a ifstream (input file stream) object to attach to the physical text file. Note: unlike an output file, a file opened for input must exist, otherwise the ifstream experiences a fail state. And just as you learned with the cin istream object, when in the fail state the program continues to run without warning. You should always check the file state after an attempt to open a file for reading or writing. The code required in main string billingDataFile "Water Bill Records.txt"; ifstream fin; fin.open(billingDataFile) attach the file stream to the physical file // fin is a user-defined object of type ifstream (input file stream) ile ed cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
