adding cs142 code
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user