33 lines
831 B
C++
33 lines
831 B
C++
#include "faculty.h"
|
|
#include "employee.h"
|
|
#include <cstdlib>
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
faculty::faculty(string name, double pay_rate, int hours, string type) : employee(name, pay_rate, hours, type),
|
|
grad_students(set_grad_students()) {}
|
|
|
|
int faculty::get_salary() {
|
|
double pay_rate_return = 0;
|
|
if(grad_students > 0){
|
|
double percent;
|
|
pay_rate_return = pay_rate;
|
|
for(int i = 0; i < grad_students; i++){
|
|
percent += 0.05;
|
|
}
|
|
pay_rate_return += pay_rate*percent;
|
|
return pay_rate_return;
|
|
}
|
|
return pay_rate;
|
|
}
|
|
|
|
int faculty::get_grad_students() {
|
|
return grad_students;
|
|
}
|
|
int faculty::set_grad_students() { //gets random number of grad students for faculty
|
|
srand(time(NULL));
|
|
int students = rand() % 5;
|
|
return students;
|
|
}
|