A3 Report
A3 Report
UOW ID : 7433098
Tutorial Group : T06F
Assignment 3 Report
The program will receive user input (a choice from 1 - 7). 1 for record entry, 2 to filter which of
the 4 classes of objects to show (point 2d,3d and line 2d,3d), 3 to set sorting options based on
the object class, 4 to set if sorting is done in increasing or decreasing order, 5 to display existing
records, 6 to write to a file and 7 to quit. Operator overriding should be used to improve
meaning throughout the program and generic programming should be used to reduce the
overall lines of code.
2. Program design:
Class relations
3. Summary of function implementation:
Classes and structs:
Point3D inherits data from Point2D, and stores an additional variable, its z coordinate.
Line3D inherits data from Line2D, but it stores 2 3D points instead of 2D.
The Records struct stores 4 vectors, each of the previously mentioned classes. It also
contains a function to sort the vectors based on a user input and one to output the filtered
vector into a stream.
Main program:
The user is prompted to enter an option, then they will be taken to a submenu based on the
interpreted program requirements.
The *inString functions are used to convert the user options (eg. a, b, c) into strings for
display purposes.
After each option change, the records are sorted as the records have to be sorted upon both
display and output.
pressEnterToReturn() is used to pause the display till the user presses enter.
4. Reflection:
Through this assignment, I’ve improved my knowledge of c++ along with reinforcing the
things learned through the previous assignment. Some new things used here are operator
overloading as well as generic programming. I also spent some time to explore using “auto”
as well.