-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee.cpp
More file actions
54 lines (41 loc) · 1.18 KB
/
Employee.cpp
File metadata and controls
54 lines (41 loc) · 1.18 KB
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
//creation of the employee class
//start with includes
#include <iostream>
#include <string>
using namespace std;
//now we can define the class
class Employee{
//we're going to need a constructor for the data types
//employee class is one of:
//first name(type string), last name(type string) monthly salar(type int)
//if the salary not positive set to zero, create setters and getters for all
public:
Employee( string firstname, string lastname, int monthlysalary){
setFirstname(firstname);
setLastname(lastname);
setMonthlysalary(monthlysalary);
}
//now create setters and getters for each
//let's start with the string firstname
//create a getter first
string getFirstname(){
return Firstname;
}
void setFirstname(string firstname){
Firstname= firstname;
}
//now with lastname
string getLastname(){
return Lastname;
}
void setLastname(string lastname){
Lastname= lastname;
}
int getMonthlySalary(){
return Monthlysalary;
}
void setMonthlysalary(monthlysalary){
Monthlysalary= monthlysalary;
}
// we can test this out
};