Hello NQE Enthusiasts,
Here is another Koan challenge. Use pattern list to find the following using Arithmetic Operators from the NQE documentation.
Target:
Bonus = Tenure * 1000
Annual Bonus = Bonus + 10000
Stock Award = 25 * Tenure
Union Donation = Bonus + Annual Bonus / 10
Bonus Pool = 200000
Bonus Allocation = Bonus Pool / Bonus + Annual Bonus
fin = "finance";
eng = "engineering";
sales = "sales_team";
Input:
persons =
/{ Name: "Fred", Tenure: 1, Department: fin },
{ Name: "Justine", Tenure: 2, Department: fin },
{ Name: "Barney", Tenure: 3, Department: eng },
{ Name: "Joey", Tenure: 4, Department: eng },
{ Name: "Jack", totalsales: 20000, Tenure: 5, Department: sales },
{ Name: "Mike", totalsales: 10000, Tenure: 6, Department: sales },
{ Name: "Sam", totalsales: 30000, Tenure: 3, Department: sales },
{ Name: "Harry", totalsales: 25000, Tenure: 2, Department: sales }
];
Result:
select distinct {
Name: person.Name,
Tenure: person.Tenure,
Bonus: bonus,
Annual_Bonus: annualbonus,
Stock_Award: stockaward,
Union_donation: uniondonation,
Bonus_allocation: bonusallocation,
Try not to look at the replies until you have tried the challenge yourself.