-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exercise 5.cpp
103 lines (103 loc) · 1.72 KB
/
Exercise 5.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include<iostream.h>
#include<conio.h>
const int len=80;
class student
{
private :
char school[len];
char degree[len];
public:
void get()
{
cout<<"\n Student Class";
cout<<"\n Enter name of school or university: ";
cin>>school;
cout<<"Enter highest degree earned \n";
cout<<"(highschool,bachelor\'s,Master\'s,Phd)";
cin>>degree;
}
void put()
{
cout<<"\n Student Class";
cout<<"\n School or University"<<school;
cout<<"\n highest degree earned :"<<degree;
}
};
class employee
{
private:
char name[len];
unsigned long number;
public:
void getdata()
{
cout<<"\n Employee Class";
cout<<"\n Enter last name: ";
cin>>name;
cout<<"Enter number:";
cin>>number;
}
void putdata()
{
cout<<"\n Employee Class:";
cout<<"\n Name:"<<name;
cout<<"\n Number :"<<number;
}
};
class manager:private employee,private student
{
private:
char title[len];
double dues;
public:
void getdata()
{
employee::getdata();
cout<<"Enter Title :";
cin>>title;
cout<<"Enter golf club dues: ";
cin>>dues;
student::get();
}
void putdata()
{
employee::putdata();
cout<<"\n Title : "<<title;
cout<<"\n Golf club dues:"<<dues;
student::put();
}
};
class scientist:private employee,private student
{
private:
int pubs;
public:
void getdata()
{
cout<<"Enter number of pubs:";
cin>>pubs;
student::get();
}
void putdata()
{
employee::putdata();
cout<<"\n Number of publications:"<<pubs;
student::put();
}
};
int main()
{
manager m1;
scientist s1;
clrscr();
cout<<"\n\t\t\t Enter data for manager";
m1.getdata();
cout<<"\n\t\t\t Enter data for scientist";
s1.getdata();
cout<<"\n\t\t\t Data on managers";
m1.putdata();
cout<<"\n\t\t\t Data on scientist";
s1.putdata();
getch();
return 0;
}