Theme Formulation
In Romania, for full-time employees, during normal working hours is 8 hours per day
and 40 hours per week (MaxNoOvertime). For all
hours worked in a week over ( these 40 hours
a week) the company must pay its employee
(with overtime working) one time and half
(BonusRate) the normal salary per hour. The
employees that earn a salary more
than 150€ per week must pay a supplemental tax
of 25% (due) from what is more than 150€
(MaxNoDue).
Requirement
Write a pseudocode/flowchart
to compute an employee's overtime pay and net
pay.
A Solution to the problem
We know:
MaxNoOvertime=40h
BonusRate=1.5
MaxNoDue=150€
Due=25%
|
We want:
GrossPay=?
NetPay=?
|
We need to supply to the algorithm the values for:
HoursWorked
HourRate
|
|
A) A pseudocode solution
Steps:
S1.
Start;
S2.
Initialize the known variables: max hours worked with no overtime (MaxNoOvertime),
bonus rate for overtime hours (BonusRate),
non taxable payroll amount (MaxNoDue), tax rate (Due);
S3.
Enter hours worked overtime (HoursWorked) and hourly rate (HourRate);
S4.
If (HourWorked-MaxNoOvertime)<=0
Then
GrossPay=HoursWorked*HourRate;
Else
GrossPay=HourRate*(MaxNoOvertime + BonusRate*(HoursWorked-MaxNoOvertime));
S5.
If
GrossPay<=MaxNoDue
Then
NetPay=GrossPay;
Else
NetPay=GrossPay-Due*(GrossPay-MaxNoDue);
S6.
Display GrossPay,
NetPay;
S7.
End.