school/cs142/final/employee.cpp

36 lines
703 B
C++

#include "employee.h"
#include <iostream>
using namespace std;
employee::employee(string name, double pay_rate, int hours, string type) :
name(name), pay_rate(pay_rate), hours(hours), type(type) {}
string employee::get_name(){
return name;
}
double employee::get_payrate() {
return pay_rate;
}
int employee::get_hours() {
return hours;
}
string employee::get_type() {
return type;
}
void employee::reset_hours() {
hours = 0;
}
void employee::set_hours(int input) {
hours += input;
}
ostream & operator<<(ostream & os, employee & t){ //makes printing out employee easy
os << t.type << " " << t.pay_rate << " " << t.name << " " << t.hours;
return os;
}