adding cs142 code
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#include "hourly.h"
|
||||
#include "employee.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
hourly::hourly(string name, double pay_rate, int hours, string type) : employee(name, pay_rate, hours, type) {}
|
||||
|
||||
int hourly::get_salary() {
|
||||
int salary;
|
||||
int overtime;
|
||||
if((hours - 170) > 0) {
|
||||
overtime = (hours - 170);
|
||||
salary = 170 * pay_rate;
|
||||
salary += overtime * (pay_rate * 1.5);
|
||||
return salary;
|
||||
}
|
||||
salary = hours * pay_rate;
|
||||
return salary;
|
||||
}
|
||||
Reference in New Issue
Block a user