#include<iostream>
using namespace std;
class Employees //here i make a parent class name employee
{
protected: //in private part we declare some variable
string name,job_title;
int data_of_joining;
public:
void getdataE(string x, string y,int z)
{
name=x;
job_title=y;
data_of_joining=z;
}
void displayE()
{
cout<<"your name is:"<<name<<endl;
cout<<"your job title is:"<<job_title<<endl;
cout<<"your date of joining is:"<<data_of_joining<<endl;
}
};
class manager:public Employees
{
private:
int total_experience;
public:
void getdatam(int x)
{
total_experience=x;
}
void displaym()
{
cout<<"your experience:"<< total_experience<<endl;
}
};
class teacher:public Employees
{
protected:
string qualification;
public:
void getdatat(string q)
{
qualification=q;
}
};
class regular_teacher:public teacher
{
private:
int pay_monthly;
public:
void getdatar(int y)
{
pay_monthly=y;
}
void displayr()
{
cout<<"your qualification is"<<qualification<<endl;
cout<<"youo montly pay is:"<<pay_monthly<<endl;
}
};
class visiting_teacher:public teacher
{
private:
int pay_rate,hour_worked;
public:
void getdatav(int x,int y)
{
pay_rate=x;
hour_worked=y;
}
void displayv()
{
cout<<"your qualification is"<<qualification<<endl;
cout<<"your per hour pay is:"<<pay_rate<<endl;
cout<<"your hour work is:"<<hour_worked<<endl;
}
};
int main()
{
string x,y;
int z;
cout<<"please enter the name hare:";
cin>>x;
cout<<"please enter the job title here:";
cin>>y;
cout<<"please enter the joining date here:";
cin>>z;
Employees obj1;
obj1.getdataE(x,y,z);
obj1.displayE();
int press;
cout<<"press 1 for teacher\npress 2 for manager"<<endl;
cin>>press;
if(press=1)
{
string q;
cout<<"please enter your qualification here:";
cin>>q;
teacher obj3;
obj3.getdatat(q);
cout<<"press 3 for regular teacher\n press 4 for visiting teacher:"<<endl;
cin>>press;
if(press=3)
{
int p;
cout<<"please enter you montly pay here:";
cin>>p;
regular_teacher obj4;
obj4.getdatar(p);
obj4.displayr();
}
else if(press=4)
{
visiting_teacher obj5;
obj5.getdatav(5000,9);
obj5.displayv();
}
else
{
cout<<"wrong inputs:"<<endl;
}
}
else if(press=2)
{
int exp;
cout<<"please enter your enperience in year:";
cin>>exp;
manager obj2;
obj2.getdatam(exp);
obj2.displaym();
}
else
{
cout<<"wrong input:"<<endl;
}
}
No comments:
Post a Comment