Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<string>
- using namespace std;
- int sum=0;
- class emp
- {
- string name;
- int payrate;
- public:
- emp(){
- payrate=0;
- name = "NO NAME";
- }
- void set_emp()
- {
- cout<<"Enter employee name : ";cin>>name;
- cout<<"Enter employee pay rate : ";cin>>payrate;
- sum+=payrate;
- }
- void get_emp()
- {
- cout<<"employee name : "<<name<<endl;
- cout<<"employee pay rate : "<<payrate<<endl;
- }
- void calc()
- {
- float av;
- av = sum /4;
- cout<<"The employee pay rate is : "<<av<<endl;
- }
- };
- class manager:public emp
- {
- string position,duties;
- public:
- manager()
- {
- position = duties = "KNOWN";
- }
- void set_m()
- {
- cout<<"Enter manager position : ";cin>>position;
- cout<<"Enter manager duties : ";cin>>duties;
- }
- void get_m()
- {
- cout<<"manager position : "<<position<<endl;
- cout<<"manager duties : "<<duties<<endl;
- }
- };
- int main()
- {
- emp e[4];
- for(int i=0;i<4;i++)
- {
- e[i].set_emp();
- }
- e[0].calc();
- manager m;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment