To solve this problem, you can use a loop to repeatedly prompt for and receive payroll amounts from the user. Inside the loop, you can keep a running total of the payroll amounts entered.
Here's an algorithm that outlines the steps to do this:
1. Initialize a variable total_payroll to 0.
2. Create a loop that continues until a sentinel value of 999 is entered:
a. Prompt the user to enter a payroll amount.
b. Read the payroll amount from the user.
c. If the payroll amount is equal to the sentinel value (999), exit the loop.
d. Convert the payroll amount to a numeric value if necessary.
e. Add the payroll amount to the total_payroll variable.
3. Display the total_payroll amount to the screen.
Here's the algorithm in pseudocode:
total_payroll = 0
payroll_amount = 0
loop:
display "Enter a payroll amount (or enter 999 to stop):"
read payroll_amount
if payroll_amount == 999:
break
payroll_amount = convert_to_numeric(payroll_amount)
total_payroll = total_payroll + payroll_amount
display "Total payroll amount:", total_payroll
By following this algorithm and implementing it in a programming language of your choice, you should be able to prompt for, receive, and total a collection of payroll amounts until the sentinel value of 999 is entered. Finally, you can display the total payroll amount to the screen.