program called “call_stats3.cpp solution

$14.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

This assignment is an extension of Assignment#2. You will implement a
program called “call_stats3.cpp” to process customer call records. Each
customer call record contains seven fields, which are as follows: 1) a ten digit
cell phone number (string, no dashes), 2) the number of relay stations used in
making the call (integer), 3) the length of the call in minutes (integer), 4) the net
cost of the call (double), 5) the tax rate (double), 6) the call tax (double) and 7)
the total cost of the call (double). Your program will have 3 functions: Input,
Process and Output. Your main program will call each function until the end of
the datafile has been read. Each call record will be printed to a data file.
Following are the descriptions of the functionality of each function:
1. The void function “Input” will have two parameters: an input file stream
called “in”, and a customer call record called “call_records”. The function
will read the cell_number, relays, and call_length, in minutes, into the a
call record from the data file.
2. The function “Process” will calculate the net cost of a call (net_cost), the
tax on a call (call_tax) and the total cost of the call (total_cost) using the
number of relay stations (relays) and the length in minutes of the call
(call_length) for a call record. Please consider the following:
a. The tax rate on a call (call_tax) is simply based on the number of
relay stations (relays) used to make the call (0<= relays <=5 then tax_rate= 1%; 6<= relays <=11 then tax_rate = 3%; 12<= relays<=20 then tax_rate = 5%; 21<= relays <=50 then tax_rate = 8%; relays 50 then tax_rate =12%) . b. The net cost of a call is calculated by the following formula: net_cost = ( relays / 50 x 0.40 x call_length). c. The tax on a call (call_tax) is equal to net_cost x tax_rate ( divide by 100 if tax_rate has not be converted to a decimal ). d. The total cost of a call (rounded to the nearest hundredth) is calculated by the following formula: total_cost = net_cost + call_tax . All tax and cost calculations should be rounded to the nearest hundredths. 3. The function "Output" will print every field of a call record to the file “weekly_call_info.txt”. The fields should be printed in the following order: 1) cell phone number, 2) number of relay stations, 3) length of the call in minutes, 4) net cost, 5) tax rate, 6) call tax, 7) total cost of call. You may implement more functions if you find it necessary. Please start the assignment ASAP and ask questions to make sure you understand what you must do. Remember to follow all style rules and to include all necessary documentation (consistent, indentation, proper variable names, pre/post condition, program header, function headers, and so forth.) Finally, your input data file (call_data.txt) should be in the same directory as your program source file (call_Stats3.cpp). Input Stream: In the assignment you will declare one ifstream to bind your input to the file "call_data.txt" and one ofstream to bind your output to the file “weekly_call_info.txt “. Whenever a program performs file i/o you must include the "fstream" library. Add the following statements to your program: For source file, "call_stats3.cpp":  Add "#include