-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEmployee.cpp
More file actions
58 lines (50 loc) · 1.23 KB
/
Copy pathEmployee.cpp
File metadata and controls
58 lines (50 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Employee.cpp
*
* Created on: 2016. dec. 16.
* Author: Tecra_Z50
*/
#include <string>
#include "Employee.h"
#include "ToString.h"
using namespace std;
Employee::Employee() {
employee_type = "";
employee_name = "";
base_salary = 0;
worked_hours = 0;
}
string Employee::get_name() {
return employee_name;
}
string Employee::get_status() {
return "Name: " + employee_name + ", Position: " + employee_type + ", Worked Hours: " +
ToString(worked_hours) + ", Base Salary: " + ToString(base_salary) + "\n";
}
int Employee::get_payment() {
int payment = base_salary * worked_hours;
worked_hours = 0;
return payment;
}
int Employee::get_worked_hours() {
return worked_hours;
}
void Employee::raise() throw (const char*) {
if (employee_type == "Developer")
base_salary += 5;
else if (employee_type == "Recruiter")
base_salary += 4;
else {
throw "Salary raise available only for Developers and Recruiters.";
}
}
void Employee::work(int add_working_hours) throw (const char*) {
if (add_working_hours >= 4) {
worked_hours += add_working_hours;
}
else {
throw "Working hours does not reach the limit.";
}
}
Employee::~Employee() {
}