I'm currently working on a C++ school assignment and I have 3 object types. Customer, Hire and Tour. Customer is liked to Tour and Hire. Requirement is to use Array, Vector, Map and List to hold this information based on users's selection of the data structure type. There are data files with 1000s of records and the application will read them and create the necessary objects. For a example if the user selects vector, it'll create 3 vectors containing above objects. Then following operations will be preformed on them.
- load in the large datasets we have provided for you. If the datastructure you are using supports sorting, it should be sorted by description.
- Prepare a list of customers whose have booked a tour that will occur before the end of the year
- Prepare a list of tours booked by customers who owe us more than $2000, sorted by the date their account is due
- Prepare a list of Hires by customers whose postcodes begin with a 5
I have following in my main application header file.
private:
string structureType;
Customer** customerListArray;
Tour** tourListArray;
EquipmentHire** equipmentsListArray;
vector<Customer *> customerListVector;
vector<Tour *> tourListVector;
vector<EquipmentHire *> equipmentsListVector;
std::map<string, Customer*> customerListMap;
std::map<string, Tour*> tourListMap;
std::map<string, EquipmentHire*> equipmentsListMap;
list<Customer *> customerListList;
list<Tour *> tourListList;
list<EquipmentHire *> equipmentsListList;
Then I load data on to those objects based on the user's selection. However my question is, Do I need to write different functions for each type of data structures to preform above operations, or is there a common interface I can use on all of them?
My C++ knowledge is very limited and requirement is to use C++98.
Thank you.