-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathempl.cpp
More file actions
72 lines (58 loc) · 1.84 KB
/
empl.cpp
File metadata and controls
72 lines (58 loc) · 1.84 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/** File empl.cpp
*
* @author Michael Ciaraldi
* @author Nathaniel Miller
*
* Class Employee definitions.
* Holds functions associated with the Empoyee class.
*/
#include "empl.h"
Employee::Employee() {
name = ""; // initially empty
salary = 0; // initially zero
}
Employee::Employee(string employee_name, double initial_salary) {
name = employee_name; // set the name field
salary = initial_salary; // set the salary field
}
void Employee::set_salary(double new_salary) {
salary = new_salary; // set the salary as the new salary
}
double Employee::get_salary() const {
return salary; // return the Employee's salary field
}
string Employee::get_name() const {
return name; // return the Employee's name field
}
void Employee::print() {
// print the Employee object's data
cout << "Employee name: " << name << " Salary: " << salary << endl;
}
void Employee::printv() {
// print the Employee object's data, virtual declaration version
cout << "Employee name: " << name << " Salary: " << salary << endl;
}
bool Employee::makes_more_than(Employee emp) {
/* notify users of what is being compared */
cout << "Is input Employee's salary of " << emp.get_salary()
<< " less than current Employee's salary of " << salary << endl;
/* compare the two salaries of the Employee objects */
if( emp.get_salary() < salary ) {
return true;
} /* end if */
else {
return false;
} /* end else */
}
bool Employee::makes_more_than(Employee* emp) {
/* notify users of what is being compared */
cout << "Is input Employee's salary of " << emp->get_salary()
<< " less than current Employee's salary of " << salary << endl;
/* compare the two salaries of the Employee objects pointed to */
if( emp->get_salary() < salary ) {
return true;
} /* end if */
else {
return false;
} /* end else */
}