Answer to Question #218510 in C++ for Srikanth Kodamasim

Question #218510
Create the class Employee with the following attributes: EmpID, Name, Designation and Experience (in terms of number of years). Add a function Show() to print all details. Add a

pure virtual function SetDesignation() which should be defined in sub classes. Derive two

classes Technical Employee and Non TechnicalEmployee from Employee and override the

Set Designation() method appropriately based on the following conditions. Add necessary

constructors in base and derived classes to initialize all the data members except

Designation.

TechnicalEmployee SetDesignation method needs to be overridden based on Experience as follows

Experience Designation <6 Software Engineer

6 and <8 Senior Software Engineer

8 and 12 Project Lead

>12 Project Manager



the following through the main() function.

1) Create an array of pointers (emp) to Employee class with size 4 Store 2 numbers of technical employees and store 2 numbers of nontechnicalemployee.and print designation and details.
1
Expert's answer
2021-07-19T00:35:05-0400


#include <iostream>


using namespace std;


class Employee{
    protected:
       int EmpID;
       string Name;
       string Designation;
       int Experience;
    public:
        Employee(int e,string n, int ex){
            EmpID=e;
            Name=n;
            Experience=ex;
        }
        Employee(){
            
        }
        void show(){
            cout<<"\nEmployee ID: "<<EmpID;
            cout<<"\nName: "<<Name;
            cout<<"\nDesignation: "<<Designation;
            cout<<"\nExperience: "<<Experience;
        }
        void  SetDesignation()=0;
        
};
class TechnicalEmployee: public Employee{
    public:
        void SetDesignation(){
            int d;
           d=Designation; 
        }
};


class NonTechnicalEmployee: public Employee{
    public:
        void SetDesignation(){
            int d1;
            d1=Designation;
        }
};
int main()
{
    Employee e;
    TechnicalEmployee t;
    NonTechnicalEmployee n;


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS