#include <iostream>
#include <stdlib.h>
using namespace std;
class staff
{
protected:
char name[20],id[5];
int age;
};
class teacher:public staff
{
protected:
char subject[10];
public:
void getinfo()
{
cout<<"\nEnter Name: ";
cin>>name;
cout<<"Enter Age: ";
cin>>age;
cout<<"Enter Employee ID: ";
cin>>id;
cout<<"Enter Subject of Publication: ";
cin>>subject;
}
void putinfo()
{
cout<<"Name: "<<name;
cout<<"\nAge: "<<age;
cout<<"\nEmployee ID: "<<id;
cout<<"\nSubject: "<<subject;
}
};
class typist:public staff
{
protected:
int speed;;
public:
void typ()
{
cout<<"Enter Typing Speed(Out of 5): ";
cin>>speed;
}
};
class regular:public typist
{
protected:
int salary;
public:
void inp()
{
typ();
cout<<"Enter Monthly Salary: ";
cin>>salary;
}
void outp()
{
cout<<"\nTyping Speed:" <<speed;
cout<<"\nAnnual Salary: "<<salary*12;
}
};
class casual:public typist
{
protected:
int days,sal;
public:
void getdata()
{
typ();
cout<<"Enter Number of Working Days: ";
cin>>days;
cout<<"\nEnter Salary per Day: ";
cin>>sal;
}
void showdata()
{
cout<<"\nTyping Speed:" <<speed;
cout<<"\nTotal Salary:"<<sal*days;
}
};
class officer:public staff
{
protected:
char grade;
public:
void getd()
{
cout<<"Enter Grade: ";
cin>>grade;
}
void display()
{
cout<<"\nGrade: "<<grade;
}
};
int main()
{
system("COLOR D");
char ch;
cout<<"\t******EMPLOYEE DATABASE******\n";
teacher t;
t.getinfo();
cout<<"Enter Typist Choice:(r/c)\n";
cout<<"R:Regular Typist C:Casual Typist\n";
cin>>ch;
if(ch=='r'||ch=='R')
{
regular s;
s.inp();
}
else
{
casual s;
s.getdata();
}
officer x;
x.getd();
cout<<"\n\n\t****Employee Information****\n";
t.putinfo();
if(ch=='r'||ch=='R')
{
regular s;
s.outp();
}
else
{
casual s;
s.showdata();
}
x.display();
return 0;
}
#include <stdlib.h>
using namespace std;
class staff
{
protected:
char name[20],id[5];
int age;
};
class teacher:public staff
{
protected:
char subject[10];
public:
void getinfo()
{
cout<<"\nEnter Name: ";
cin>>name;
cout<<"Enter Age: ";
cin>>age;
cout<<"Enter Employee ID: ";
cin>>id;
cout<<"Enter Subject of Publication: ";
cin>>subject;
}
void putinfo()
{
cout<<"Name: "<<name;
cout<<"\nAge: "<<age;
cout<<"\nEmployee ID: "<<id;
cout<<"\nSubject: "<<subject;
}
};
class typist:public staff
{
protected:
int speed;;
public:
void typ()
{
cout<<"Enter Typing Speed(Out of 5): ";
cin>>speed;
}
};
class regular:public typist
{
protected:
int salary;
public:
void inp()
{
typ();
cout<<"Enter Monthly Salary: ";
cin>>salary;
}
void outp()
{
cout<<"\nTyping Speed:" <<speed;
cout<<"\nAnnual Salary: "<<salary*12;
}
};
class casual:public typist
{
protected:
int days,sal;
public:
void getdata()
{
typ();
cout<<"Enter Number of Working Days: ";
cin>>days;
cout<<"\nEnter Salary per Day: ";
cin>>sal;
}
void showdata()
{
cout<<"\nTyping Speed:" <<speed;
cout<<"\nTotal Salary:"<<sal*days;
}
};
class officer:public staff
{
protected:
char grade;
public:
void getd()
{
cout<<"Enter Grade: ";
cin>>grade;
}
void display()
{
cout<<"\nGrade: "<<grade;
}
};
int main()
{
system("COLOR D");
char ch;
cout<<"\t******EMPLOYEE DATABASE******\n";
teacher t;
t.getinfo();
cout<<"Enter Typist Choice:(r/c)\n";
cout<<"R:Regular Typist C:Casual Typist\n";
cin>>ch;
if(ch=='r'||ch=='R')
{
regular s;
s.inp();
}
else
{
casual s;
s.getdata();
}
officer x;
x.getd();
cout<<"\n\n\t****Employee Information****\n";
t.putinfo();
if(ch=='r'||ch=='R')
{
regular s;
s.outp();
}
else
{
casual s;
s.showdata();
}
x.display();
return 0;
}