you are required to develop a program that reads in and process some &acirc;€˜messy&acirc;€™ records from a file that contains data meant for different kinds of classes. These data are jumbled up and unsorted, and to make it worse, for any particular row of record, there may be multiple duplicates scattered over the entire file!
You program should posses the following capabilities:
a) read in the records from a user-specified filename
b) remove all duplicate rows of data
c) filter and display the data according to user-specified sorting criteria
d) store the records displayed in c), in a user-specified filename
The next section provides information about the requirements for developing this program.
A) Appendix A provides a sample input data from a file called &acirc;€˜messy.txt&acirc;€™. It contains information meant to be stored in 4 classes: &acirc;€˜Point2D&acirc;€™, &acirc;€˜Point3D&acirc;€™, &acirc;€˜Line2D&acirc;€™ and &acirc;€˜Line3D&acirc;€™. Please refer to the table in Appendix A for a description of the format in which the input data for each of the classes is stored.
B) Note1: To read in data, you are required to create your own input manipulator(s) to extract the input filename from user, and/or determining which of the 4 classes (mentioned above) the record is meant for.
After the relevant input file stream has been established, you are further required to overload the extraction operator &acirc;€˜>>&acirc;€™, for each of the 4 classes, to support the process of extracting data from file stream and storing it into the relevant object.
C) Note2: You are to research and determine which kind of STL containers (e.g. Map, Vector, Set, Lists etc) you should use, to store all the various objects from the 4 classes. you are not allowed to use array [ ] to store any of your data!
D) Appendix B provides a description of the 4 classes: &acirc;€˜Point2D&acirc;€™, &acirc;€˜Point3D&acirc;€™, &acirc;€˜Line2D&acirc;€™ and &acirc;€˜Line3D&acirc;€™, and the relationships between them. You are to study the diagrams and implement them accordingly.
E) Appendix C provides the sample output format and a description of the format requirements, for each of the 4 classes. These format are to be applied whether the data from these classes are output to a file or terminal.
F) Note3: To output data, you are required to create your own output manipulator(s) to display/store data in the format described in Appendix C. You are further required to overload the insertion operator &acirc;€˜<<&acirc;€™, for each of the 4 classes, to support the process of inserting data to the terminal, or the relevant file stream.
G) Note4: All output data must not contain any duplicates! There are many approaches to solving this problem. Firstly, you could check for, and remove duplicate records at the point of reading in the input. Alternatively, you could temporarily store the data in a STL container, research and make use of any STL algorithm to search for, and remove the duplicates. Another (inefficient) way is to store everything in STL container, but your program needs to ensure that when user wishes to see / store the records in a file, no duplicate records are shown.
H) Appendix D provides a description of 5 generic template functions that you are supposed to develop. These &acirc;€˜utility&acirc;€™ functions plays a supporting role, and they should be developed in a separate header file called &acirc;€˜MyTemplates.h&acirc;€™.
I) Your program should allow user specify the filtering criteria so that user can specify which set of records he wishes to view / store. Your program should allow the following options:
i) Point2D records <= default selected option
ii) Point3D records
iii) Line2D records
iv) Line3D records
J) Your program should allow user to specify the sorting criteria so that user can specify which attributes (of a set of records) to order the data by. The sorting criteria is based on the current filtering criteria.
For example, if the current filtering criteria is &acirc;€˜Only Point2D records&acirc;€™, your program should restrict user to the options of sorting the data by &acirc;€˜x&acirc;€™, &acirc;€˜y&acirc;€™ & scalar value &acirc;€˜distFrOrigin&acirc;€™ only!