I have created a database for employee information. I have using a mapping container using the employee's ID number as the Key. The database stores data for three departments in the company and so i have an abstract base class (employee) and three derived classes for each department (HR, electronics, admin). At the minute the user interface asks the user first to last.
How many employees do you wish to enter?
What department is the employee in HR [H], electronics [E] or admin [A]?
What is the employees name?
what is the employees ID number?
What is the employees area of expertese?
At what level is the employee competent to within this area (1 to 5)?
All this information is stored within the map container and is printed out. The abstract base class has a pure virtual function
virtual void print()=0;
and then each of the derived classes has a print function to print out the information, but this is only for one area of expertese per employee. However, i wish to be able to allow there to be the possibility of having up to 3 areas of expertese per employee. And so i think i may need a pure virtual function in the abstract base class, possibly....
virtual void addarea()=0;
and then functions in each of the derived classes to add an area of expertese.
My issue is i am not sure how to do this, or how i may store the information for up to 3 areas of expertese. And then incorporate this store into my print function within each of the classes so that when it comes to printing out the data, i will have all the employees information printed out along with their three areas of expertese and the levels of the employee's level of competence within these areas. Possibly in an array or a vector of strings. I Really seem to have got myself quite stuck.
Any ideas or help with this would be much appreciated?
You can't just derive Employee, this would limit an employee to only one area of expertise.
You can eventually make a base Expertise class, with an abstract print() method.
Then derive that for each area of expertise, and store for an Employee a list of Expertise pointers in the container most suited for your program if you wish
So again just to say where i need the help i would like to make it so that for each employee i can have up to 3 areas of expertese and the level the employee is at associate with this. In this example the area of expertese is the variable 'earea' and the level they are at is 'elevel'.
In that case, maybe you could have a multimap (allows multiple identical keys), and multiple Employee childs per person, then include all the Employee pointers with the same employee ID in the multimap. But then you would have the generic emplotee info multiple times.
I think you have to separate the base employee information and specific information in two differnet classes for a better solution