-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFullTimeEmployee.cpp
67 lines (56 loc) · 1.61 KB
/
FullTimeEmployee.cpp
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
59
60
61
62
63
64
65
66
67
#include "FullTimeEmployee.h"
#include "input_validation.h"
FullTimeEmployee::FullTimeEmployee()
{
set_fulltime_employee_data();
}
FullTimeEmployee::FullTimeEmployee(const FullTimeEmployee &other) : Employee(other), monthlySalary(other.monthlySalary)
{
}
FullTimeEmployee::~FullTimeEmployee()
{
}
void FullTimeEmployee::set_fulltime_employee_data()
{
this->setName();
this->setDOB();
this->setPhoneNumber();
this->setAddress();
this->setJobRole();
this->setMonthlySalary();
this->setAge();
}
int FullTimeEmployee::calculateSalary() const
{
return monthlySalary;
}
void FullTimeEmployee::displayInfo() const
{
Employee::displayInfo();
cout << "Monthly Salary: " << monthlySalary << " $" << endl;
}
void FullTimeEmployee::setMonthlySalary()
{
while (true)
{
validate_input_int(monthlySalary, "Enter the salary (max 60k $): ", "Invalid salary, please try again...");
if (monthlySalary > 0 && monthlySalary <= 60000)
break;
}
}
int FullTimeEmployee::getMonthlySalary() const
{
return monthlySalary;
}
ostream &operator<<(ostream &out, const FullTimeEmployee &ftEmp)
{
out << "Name: " << ftEmp.name << endl;
out << "ID: " << ftEmp.id << endl;
out << "Job Role: " << ftEmp.jobRole << endl;
out << "Date of Birth: " << ftEmp.dob.getDay() << "/" << ftEmp.dob.getMonth() << "/" << ftEmp.dob.getYear() << endl;
out << "Phone Number: " << ftEmp.phoneNumber << endl;
out << "Address: " << ftEmp.address << endl;
out << "Age: " << ftEmp.age << endl;
out << "Monthly Salary: " << ftEmp.monthlySalary << " $" << endl;
return out;
}