-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStipendEmployee.cpp
More file actions
43 lines (35 loc) · 1.26 KB
/
StipendEmployee.cpp
File metadata and controls
43 lines (35 loc) · 1.26 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
// Copyright (c) 2024. Howard Community College All Rights Reserved. Unauthorized Duplication Prohibited.
//
#include <iomanip>
#include "StipendEmployee.h"
using namespace std;
/*
* Constructs the StipendEmployee, setting the total number of dollars and the total number of hours worked
* The base class Employee is also initialized correspondingly
*/
StipendEmployee::StipendEmployee(int id, std::string name, double totalDollars, double totalHours) : Employee(id, name) {
StipendEmployee::totalStipend = totalDollars;
StipendEmployee::totalHours = totalHours;
}
/*
* Returns the total number of dollars that are paid to the Employee
*/
double StipendEmployee::getTotalDollars() const {
return StipendEmployee::totalStipend;
}
/*
* Returns the total number of hours that are worked by the Employee
*/
double StipendEmployee::getTotalHours() const {
return StipendEmployee::totalHours;
}
/*
* Prints the string name, int ID, double Weekly pay as given by totalStipend / (totalHours / 40)
*/
void StipendEmployee::printPay() {
cout << "Name: " << this->getName() << endl
<< "ID: " << this->getID() << endl;
cout << setprecision(2);
cout << fixed;
cout << "Weekly Pay: $" << this->totalStipend / (totalHours / 40) << endl << endl;
}