-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworkAround.js
42 lines (33 loc) · 1.45 KB
/
workAround.js
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
const workAround = {};
let salary = 100000;
let payGrades = {
entryLevel: { taxMultiplier: .05, benefits: ['health'], minSalary: 10000, maxSalary: 49999 },
midLevel: { taxMultiplier: .1, benefits: ['health', 'housing'], minSalary: 50000, maxSalary: 99999 },
seniorLevel: { taxMultiplier: .2, benefits: ['health', 'housing', 'wellness', 'gym'], minSalary: 100000, maxSalary: 200000 }
};
workAround.getCadre = function getCadre() {
if (salary >= payGrades.entryLevel.minSalary && salary <= payGrades.entryLevel.maxSalary) {
return 'entryLevel';
} else if (salary >= payGrades.midLevel.minSalary && salary <= payGrades.midLevel.maxSalary) {
return 'midLevel';
} else return 'seniorLevel';
}
workAround.calculateTax = function calculateTax() {
return payGrades[workAround.getCadre()].taxMultiplier * salary;
}
workAround.getBenefits = function getBenefits() {
return payGrades[workAround.getCadre()].benefits.join(', ');
}
workAround.calculateBonus = function calculateBonus() {
return .02 * salary;
}
workAround.reimbursementEligibility = function reimbursementEligibility() {
let reimbursementCosts = { health: 5000, housing: 8000, wellness: 6000, gym: 12000 };
let totalBenefitsValue = 0;
let employeeBenefits = payGrades[workAround.getCadre()].benefits;
for (let i = 0; i < employeeBenefits.length; i++) {
totalBenefitsValue += reimbursementCosts[employeeBenefits[i]];
}
return totalBenefitsValue;
}
module.exports = workAround ;