bonus_amount(years_of_service, performance_rating, is_probation) that computes a bonus. Employees on probation get 0. Otherwise: performance_rating of 5 gives a 15% bonus if years_of_service >= 3, else 10%. performance_rating of 4 gives 10% if years_of_service >= 3, else 5%. performance_rating of 3 or below gives 0%. The function returns the bonus percentage as an integer (e.g. 15, not 0.15).bonus_amount(4, 5, False)
15
Top rating with 3+ years of service.
bonus_amount(1, 5, False)
10
Top rating but under 3 years.
bonus_amount(10, 5, True)
0
On probation, so no bonus regardless of other factors.
bonus_amount(5, 3, False)
0
Rating of 3 or below never qualifies.
The probation guard clause should be checked first and short-circuit everything else.
Nest a years_of_service check inside each of the rating==5 and rating==4 branches.