" write a program that implements the following C++ concepts
1. Data Encapsulation
2. Instantiate classes
3. Composition Class
4. Aggregation Class
5. Dynamic Memory
6. File Stream
Make a program that reads a file and can generate reports. Each file will have phone calls records (see section 4). The program will process the data gathering all minutes and total amount for each report. The program should have a menu (see section 1):
1. New Report – this option will ask a file name (TE??????.tel). This option will instantiate an object of Report class, loading the whole file into memory.
2. Delete a report – this option will display all reports available in memory and ask which one you would like to delete.
3. Display a report – this option will display all reports available in memory and ask you which one you would like to generate a report.
4. Exit – Program ends.
For option 1, you do not know how many reports are, meaning that you will create dynamically the reports.
3. Report
• Data * records
• string fileName
• int totalRecords
• float totalMinutes
• float totalAmount
4. DataParser
• Data record
Each of the classes will have the constructors, destructors, accessors, mutators and operators overloading.
Class DataParser will have a constructor that received a String, with the line to be parsed. "
Okay I need some guidance in the right direction. This was assigned even tho up to this point I've yet to be taught the concepts of file streaming. I also don't understand how "DataParser" is suppose to work. I don't even know what parsing means. I take I should relate the Data* records" in the Reports class to the "Data records " in the DataParser in someway? Or just allocate memory and have the pointer "Data * records" point to it in the constructor of the Reports class? I just need some clarification in how i should approach this.
Carlos Miguel Rodriguez Soto 01262015015300015560078739922347872342345
Felix Gabriel Perez Roman 01192015009020509401478723456437873451234
David Piere Soto Colon 12232014111340912410578735623453054562345
Regarding the long numbers:
The records are simply packed together. The first 8 characters are a date, the next character describes whether or not the call was long-distance, then two dates; and finally two phone numbers.
I don't even know what parsing means.
parse: v.: to analyze (a string or text) into logical syntactic components
You're supposed to take a string and split it into usable data. Apparently, a Data object.
Data* records I assume is supposed to reference an array of Data you've produced from the lines of the file using an instance of DataParser.
Yes, you read each line one by one, then do whatever to the line you have read.
Okay I think I have some clear insight on how to do this now. One last thing. How about if i want to store each fruit in the following text in a string?
. Does this mean that within the Reports class I should dynamically create an array of
Data
and have the pointer
Data * records
from the Records class point to it ? Then assign values to each using information from the dynamically created array ?
Does this mean I should make two dynamic arrays then ? Since the instructions say
New Report – this option will ask a file name (TE??????.tel). This option will instantiate an object of Report class, loading the whole file into memory.
For option 1, you do not know how many reports are, meaning that you will create dynamically the reports