56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
|
#include "Employee.h"
|
||
|
#include "WageEmployee.h"
|
||
|
|
||
|
//
|
||
|
// Created by caleb on 4/23/24.
|
||
|
//
|
||
|
WageEmployee::WageEmployee() {
|
||
|
this->wage = 0;
|
||
|
this->hours = 0;
|
||
|
}
|
||
|
|
||
|
WageEmployee::WageEmployee(const char * pName, double wage, int hours) : Employee(pName) {
|
||
|
this->wage = wage;
|
||
|
this->hours = hours;
|
||
|
}
|
||
|
WageEmployee::WageEmployee( WageEmployee & ) {
|
||
|
this->wage = 0;
|
||
|
this->hours = 0;
|
||
|
}
|
||
|
WageEmployee::~WageEmployee() = default;
|
||
|
|
||
|
WageEmployee & WageEmployee::operator=( WageEmployee & other) {
|
||
|
this->hours = other.hours;
|
||
|
this->wage = other.wage;
|
||
|
return *this;
|
||
|
}
|
||
|
|
||
|
int WageEmployee::getHours() const {
|
||
|
return hours;
|
||
|
}
|
||
|
void WageEmployee::setHours(int hours) {
|
||
|
this->hours = hours;
|
||
|
}
|
||
|
|
||
|
double WageEmployee::getWage() const {
|
||
|
return wage;
|
||
|
}
|
||
|
|
||
|
void WageEmployee::setWage(double wage) {
|
||
|
this->wage = wage;
|
||
|
}
|
||
|
|
||
|
std::string WageEmployee::toString() {
|
||
|
std::string returnString;
|
||
|
returnString.append("Employee Name: ").append(getName()).append("\n")
|
||
|
.append("Wage: ").append(std::to_string(wage)).append("\n")
|
||
|
.append("Hours: ").append(std::to_string(hours)).append("\n");
|
||
|
return returnString;
|
||
|
}
|
||
|
double WageEmployee::computePay() {
|
||
|
return wage * hours;
|
||
|
}
|
||
|
|
||
|
double WageEmployee::weeklyPay() {
|
||
|
return computePay() * 7;
|
||
|
}
|