-
Notifications
You must be signed in to change notification settings - Fork 0
/
4thQuestion.cpp
43 lines (34 loc) · 872 Bytes
/
4thQuestion.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
#include <iostream>
using namespace std;
class Employee{
public:
Employee(){
empNumber = 0;
empCompensation = 0;
}
Employee(int number, float compensation){
empNumber = number;
empCompensation = compensation;
}
void setdata(int number, float compensation){
empNumber = number;
empCompensation = compensation;
}
void getdata(){
cout << "Employee Number: " << empNumber << endl;
cout << "Employee Compensation: " << empCompensation << endl;
}
private:
int empNumber;
float empCompensation;
};
int main(){
Employee obj1(1, 30.5);
Employee obj2(2, 50);
Employee obj3;
obj3.setdata(3, 40.8);
obj1.getdata();
obj2.getdata();
obj3.getdata();
return 0;
}