In a factory, you want to calculate a special bonus for workers, based on in the
ID: 3741830 • Letter: I
Question
In a factory, you want to calculate a special bonus for workers, based on
in the number of overtime hours worked and the number of hours the worker has been absent
From his job.
The following formula will be used: Calculation rate = overtime - (5/6) x absent hours.
After finding the calculation rate, the following table is followed:
Write a program that asks for the extra and absent hours of each employee and calculates the value
of the bond to pay. Matlab script.
Explanation / Answer
Matlab Script:
overtime = input("Enter over time hours: ");
absent = input("Enter absent hours: ");
calculationRate = overtime - (5/6)*absent;
if calculationRate <= 10
bonus = 100;
elseif calculationRate <= 20
bonus = 500;
elseif calculationRate <= 30
bonus = 1000;
elseif calculationRate <= 40
bonus = 2000;
else
bonus = 5000;
end
fprintf("Bonus: %d", bonus);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.