solve this

A company stores the information of her employees in a database. There are only three kinds of employees represented. Managers manage, scientists perform research to develop better widgets, and laborers operate the dangerous widget-stamping presses.

The database stores a name and an employee identification number for all employees, no matter what category they are. However, for managers, it also stores their titles and golf club dues. For scientists it stores the number of scholarly articles they have published. Laborers need no additional data beyond their names and numbers.

Show how this model can be represented diagrammatically. Write a program which will implement the hierarchy described above. The program starts with a base class employee. This class handles the employee’s last name and employee number. From this class three other classes are derived: manager, scientist, and laborer. The manager and scientist classes contain additional information about these categories of employee, and member functions to handle this information.
We're not going to give you the answer straight up. We like to help, but you need to show us that you have at least made an attempt.

The answer is given to you in paragraph 3 anyway...you don't have to design anything! The only thing left is implementation, i.e. define the classes. See http://www.cplusplus.com/doc/tutorial/inheritance/

Hope that helps. Post your attempt when you get stuck.
its not that i want an answer. i want to be shown how to go about it.
Create a class 'employee'. This class should have private member variables 'name' and 'id'. This class should be abstract (i.e. not able to be instantiated). Create another class 'manager', which derives from 'employee' and includes its relevant member variables (i.e. 'titles' and 'golfClubDues'). Do the same thing with the scientist and laborer classes.

Without writing code I don't know how much more help I can give you. If you get stuck on something, ask a specific question which we can answer more easily.

Hope that helps. Good luck :).
Topic archived. No new replies allowed.