Ask Question
26 August, 22:39

Now imagine that we have a list of 5 employees who have each worked 45, 15, 63, 23, and 39 hours. We'll fix rate_of_pay at 10. Payroll wants to mail checks for each of these employees. Use a definite loop (for loop) to loop through the list of employee hours and print the appropriate pay statement. Your output should look something like: Paying 475.0 by direct deposit Paying 150.0 by mailed check Paying 630.0 by direct deposit Paying 230.0 by mailed check Paying 390.0 by direct deposit

+3
Answers (1)
  1. 27 August, 01:35
    0
    Hi there! The question is asking for a simple loop implementation that prints payment advice for Payroll.

    Explanation:

    Assuming that the payment method is "mailed check" for hours worked less than 30 and "direct deposit" for hours worked greater than 30, we can implement the function as below.

    hours_worked = [45, 15, 63, 23, 39]

    payment_method = "mailed check"

    for (int index = 0; index < 5; index++) {

    if hours_worked[index] > 30 {

    payment_method = "direct deposit"

    }

    print ("Paying " + (hours_worked[index] * pay_rate) + "by " + payment_method)

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Now imagine that we have a list of 5 employees who have each worked 45, 15, 63, 23, and 39 hours. We'll fix rate_of_pay at 10. Payroll ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers