Question: Task (Static, Composition, inheritance, and Polymorphism) Part 1 In a university system, employees can be categorised into: academics and administrators. However, all employees share common

 Task (Static, Composition, inheritance, and Polymorphism) Part 1 In a university

system, employees can be categorised into: academics and administrators. However, all employees

share common attributes: ID, Name, Hire_Date, and salary. The Academics can have

Task (Static, Composition, inheritance, and Polymorphism) Part 1 In a university system, employees can be categorised into: academics and administrators. However, all employees share common attributes: ID, Name, Hire_Date, and salary. The Academics can have the additional attributes: Teaching_load (hours), teaching allowance. The administrators have the additional attributes: job_title, admin_allowance. Note:name and job_title are of type string, ID is const int, it is given a serial number starting from 200001, 200002, 200003, and so on. Salary, admin_allowance, Teaching_load and teaching allowance of type double. Hire_Date is of type Date (you have to write simple class Date) * Declare all data attributes as private * Given below the classes declarations Separate class interface and implementation 1) Create the base class Employee with the following functionalities: a) A constructor to initialize the data members and a virtual destructor b) A set function named set_values to change the Name, Hire_Date, and salary c) A function named print to display the details of Employee d) A virtual function named calaculate_salary ( this returns the salary) e) A pure virtual function void set_values const string, double) to act as an interface to access set_values in class Administrator, in case of Polymorphism 2) Create derived class Administrator with the following functionalities: a) A constructor to initialize the data members and a destructor b) A set function to change the job_title and admin_allowance c) A function named print to display all details including the one from the base class d) A function named calaculate_salary (this returns admin_allowance + salary). Hint: call calaculate_salary() function in base class to get salary 3) Similarly create class Academic #include using namespace std; class Date private: ant day, month, year: publie: Date (int-1, int=1, int=1935); -Date(); void print (const, Date::Date(int x, int y, int x) Hay=x; monday: yeata; Date: :-Date() void Date: :print() consti cout class Employee private: const int ID: static int serial; string Name: Date Hire Date; double Salary: public: Employee (const string n,const Date d, double s); virtual Employee(); void set values (const string n,const Date d, double s); virtual void print (); virtual double cataculate_salary(); virtual void set values (const string, double) = 0; >; int Employee :: serial-200001; class Administrator:public Employee private: string job title; double admin allowance: public: Administrator (const string n,const Date d, doublo a,const string 1, double a); -Administrator(); void set values (const string double a: void print(); Part 2 Create a class EducationAcademy that has an array of pointers of type Employee, a location of type string and an establishment Date. The previous exercise explains three classes that are fully implemented: Employee, Academic and Administrator. #include using namespace std; class EducationAcademy public: EducationAcademy (int size); // size is number of employees in the Education Academy EducationAcademy (int size, string Loc, const Date D); EducationAcademy(); void Read Current Staff 0); double Get TotalSalaries(); void Print_Current Staff (); Employee * ReadOne Employee(): private: Employee * Current Staff [1001; // to allocate a maximum of 100 Employees int no_of_Current_Staff; it should not exceed 100 string Location: 7/ default value "PSUT Date start Date; // derart 1/1/2000 In ReadOne Employee function the user will have two choices 'A for Academic and 'B' for Administrator. Based on this choice the user will enter data and allocate an object based on that and return its address, Read_Current_Staff function will use the array of pointers Current_Staff and call ReadOne Employee a number of times based on no_of_Current_Stoff. This means that a pointer will be pointing at the object created by ReadOne Employee function. Constructors will initialize the data attributes. Make sure the no_of_Current_Staff does not exceed 100, make it zero if incorrect size was used. Hint: call Read_Current_Staff function. Print_Current_Staff function will print the details of objects allocated by Current_Staff that have salaries between 2000 and 5000. Destructor will deallocate the objects according to the following order. Deallocate all objects with salaries below 1000, followed by objects with salaries below 2000, and then deallcaote all objects that have salaries above 5000. Then count the number of remaining objects Part 2 Write a program that defines an array of Education Academy pointers of size 5 named OOP_academies. Based on user input allocate dynamically the number of academies according to the size entered by the user for each Education Academy object. Print all employees of the allocated OOP_academies. Do any necessary deallocations

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!