-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee.cpp
More file actions
48 lines (39 loc) · 1.12 KB
/
Copy pathEmployee.cpp
File metadata and controls
48 lines (39 loc) · 1.12 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
/**
* @file Employee.cpp
* @author Michael Floyd
* @date 2025-04-15
* @brief Method for Employee class
*
*
*/
#include "Employee.h"
#include <iostream>
using namespace std;
//constructor for Employee
Employee::Employee() {
ID = years = hoursWorked = hourlyRate = -1;
}
//constructor for employee that sets variables
Employee::Employee(int ID, int years, double hourlyRate, float hoursWorked) {
this->ID = ID;
this->years = years;
this->hourlyRate = hourlyRate;
this->hoursWorked = hoursWorked;
}
//Prints out employee information
void Employee::print() {
cout << "Printing information for employee " << ID << ":\n Years Employed: " << years
<< "\n Hourly Rate: " << hourlyRate << "\n Hours Worked: " << hoursWorked
<< endl;
}
//Announces anniversary and increases pay
void Employee::anniversary() {
years++;//increments years worked
hourlyRate = hourlyRate + hourlyRate * .002;//Increases hourlyrate
cout << "Congratulations to employee " << ID << " on " << years << " year(s) at company!"
<< endl;
}
//computes pay
double Employee::calculatePay() {
return hourlyRate * hoursWorked;
}