Byerhill Enterprise runs a small factory. The company employs workers who are pa
ID: 3905457 • Letter: B
Question
Byerhill Enterprise runs a small factory. The company employs workers who are paid one of three hourly rates depending on skill level: Skill Level Hourly Rate (R) 5.00 10.00 15.00 15.00 Each factory worker might work any number of hours per week; any hours over 40 are paid at two times the usual hourly rate. Study the program segment below that selects the appropriate hourly rate and answer the questions that follow. if skill - 1 then salary= BASE + (hou r sovertime * (5.00 * 2) else if skill-2 then salaryBASEt (hoursOvertime * (10.00 2) else if skill -3 then salary = BASE + (hour sovertime * (15.00 * 2? else if skill = 4 then salaryBASE t (hoursOvertime * (15.00 2) endif endif endifExplanation / Answer
In the given piece of segement,skill level is checked as hourly rate dependes on it.
Initially it is checked whether skill level = 1.If it is then salary paid to the person will be the sum of base salary and extra pay.This extra pay depends on number of hours he overtimed.Extra pay = overtime hours * (5 *2) for level 1 labour
If skill level is not 1 then we move to else part where it is checked whether skill level = 2.If it is then salary paid to the person will be the sum of base salary and extra pay.Here,extra pay = overtime hours * (10 *2) for level 2 labour
If skill level is not 2 then we move to else part where it is checked whether skill level = 3.If it is then salary paid to the person will be the sum of base salary and extra pay.Here,extra pay = overtime hours * (15 *2) for level 3 labour
If skill level is not 3 then we move to else part where it is checked whether skill level = 4.If it is then salary paid to the person will be the sum of base salary and extra pay.Here,extra pay = overtime hours * (15 *2) for level 4 labour
The if else ladder ends here and now the variable "salary" contains the salary to be paid to the emploee.
Note that if overtime hours of a worker are 0 then he will only get base salary as
overtime hours * (x *2) = 0 * (x *2) = 0
Hope i have answered your question satisfactorily.Leave doubts in comment section if any
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.