Stan writes:
...oops...forgot about the 500/1500 stuff.
How about:
modify loop 1 to give $500 to each eligible employee.
remaining_dollars is the amount of money left after this step.
Now, use the pool_hours calculated in loop 1 to figure the worth of
each unmissed hour:
bonus_per_hour :=remaining_dollars / pool_hours;
for each eligible employee,
temp := (160 - missed_hours) * bonus_per_hour;
if temp > 1000 then
temp := 1000;
give employee $temp;
remaining_dollars := remaining_dollars - temp;
Now, we may have some money left over (because of the $1500 cap):
while remaining_dollars > 0 do
count # eligble employess who haven't received 1500.
Call that number N
dollars_this_time := remaining_dollars / N;
for each eligible employee who hasn't received $1500 yet:
temp := dollars_this_time;
if temp + amount_given_this_employee > 1500 then
temp := 1500 - amount_given_this_employee;
give employee temp;
remaining_dollars := remaining_dollars - temp;
end
end
--
Stan Sieler [log in to unmask]http://www.allegro.com/sieler.html