Q: info about employees contains their last, first, dad's names, position, gender, the date they joined, salary and bonus.
Bonus is not filled(declared?)
Calculate the bonus for each employee using this info:
5% is they worked for 5 years and more; 10% for >=10 years; 30% for >=20 years
....
i have some idea in my head but i just don't get how to actualize it.
i'm thinking of getting another function for calculating the bonus from the salary, but i don't know how to bring the date there
ps: if i just use the year they joined instead of the date it'll be okay by my teacher, since it's less complicated and doesn't require using libraries i'm not familiar with
thanks in advance
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
|
#include <iostream>
#include <string>
using namespace std;
struct Employee
{
string LastName;
string FirstName;
string DadsName;
string position;
char sex;
int year_joined;
double salary;
double bonus;
};
void EmployeeChart(const Employee& employee)
{
cout << "Last name: " << employee.LastName << '\n';
cout << "First name: " << employee.FirstName << '\n';
cout << "Dad's name: " << employee.DadsName << '\n';
cout << "Position: " << employee.position << '\n';
cout << "Gender: " << employee.sex << '\n';
cout << "Year joined: " << employee.year_joined << '\n';
cout << "Salary: " << employee.salary << '\n';
cout << "Bonus: " << employee.bonus << '\n';
}
/*int Bonus(const Employee& amount)
{
for()
}
*/
int main()
{
Employee laura = { "Laura", "Fidarova", "Alanovna", "stud", 'F', 2015, 45000 }; // +bonus in the end
EmployeeChart(laura);
return 0;
}
|