Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need help with this in c++ Objectives: 1. Read the contents ef a datafilel one record at a time: 2. Process the data that

i need help with this in c++
image text in transcribed
image text in transcribed
image text in transcribed
Objectives: 1. Read the contents ef a datafilel one record at a time: 2. Process the data that was read from the datafile one record at a time; 3. Print a record to a datafile using an efstream object: 4. Be able to use the fstream library 5. Be able to use records (class with enly data): 6. Be able to use an ifstream object; 7. Be able to use an efstream object; This assignment is an extension of Assignment#2 You will implement a program called "call stats3.pp" to process customer call rocords. Each customer call record contains seven ficlds, which are as follows: 1) a ten digit cell phone number (string, no dashes). 2) the mumber 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 (doublc). 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 "Inpu will have two parameters: an input file streans called "in", and a customer call recornd 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 ax) and the total cost of the call (total cost) using the nmber of relay stations (relay) and the length in mimales of the call call length) for a call record ase 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 (0relays 5 then 8%; relays >50 then Ms_rar-12%) b. The net cest of a call is cakculated by the following c. The tax on call (call-taxi is equal to net cost x tax rate ( divide d. The total cost ofa call (rounded to the nearest hundredrh) is formula: met_cost. (relys/50 x 0.40 x cull length by100 if tax rate has net be converted to a decimal calculated by the Sollowing formulac total cost - met cost call ax. All tax and cost calculations should be rounded to the nearest hundredths. 3. The function "Outpur" will print every field of a call record to the file weekly call info.tst". The fields should be printed in the following order: 1) cell phone number,2) mumber of relay stations,3) length of the call in minutes, 4) net cost, 5) tax ratc, 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 inclade all necessary documentation (consistent, indentation, proper variable names, pre post condition, program header, function headers, and so forth Finally, your input data file (cell dalau) should be in the same directory as your program source file (call Stats&qpp. 8%; relays >50 then lax rate-12%) - b. The net cost of a cel is calculated by the following C. The tax on a call (cell Nx) is egual to net costxxrate (divide d. The total cost ofe cell (reunded to the nearest hamdredthj is by100 ifx rate has mot be cnverted to a decimal J calculated by the following Soemula:ttl cost net cost+ call ax. All tax and cost calculations should be rounded to the nearest hundredths 3 Tkse function .'Oupur" wil print every field of a call tecond to the file weekly call info.tst". The fields should be printed in the following order: 1) cell phone nuber, 2) number of relay stations, 3) length of the call in minutes, 4) net cost, 5) tax ratc, 6) call tax, 7) total cost of call You may implement more functions if you find i necessary. Please start the assignment ASAP and ask questions to make sure you understand what you must do. Remember to follow all style nules 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 (cell dala txt) should be in the same directery as your program source fille (call Statskp Input Stream: In the assignment you will do late one .tream to hnd your mput to the file call data.r" and one ofstream to bind your output to the file "weekly call infot Whenever a program performs file ile you must include the "Estream"library. Add the following statements to your program For source file. "call stats&pp Add "Minclude 4stream' to yur # ndade statements in your source fil Add-include to your # include statements in your source file * * Format of the input data file(input filename is call dala: Do not include column titles (The order of the colamns are as tollows cell phone number, relays minutes 546321555 612971340 3051234567 61727889 20 Format of the input data file(input filename is "call-data..): Do not include column titles (The order of the columns are as follows: cell phone number, relays, minutes) 612971340 3054432762 5617278899 5612971340 115 544321011 7877176590 5617278899 Format of Output (output filename is "weekly call infotst") (the order of the columns is as follows: cell phone number, relays, minutes, net cost, tax rate, call tax, total call cost) 542340622 042224556 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions