Can someone give me an idea on how to get started on this program? I have been having problems on this for a week and cannot get started. I understand this in visual logic but cannot get the total amound to print. Can anyone walk me through this or show me how its done? Thanks.

Make a VisualLogic flowchart and write the Python 3.0 program for the following problem. A list of employees names, hours worked in a week and the hourly rate of pay is entered. Read in each employee’s data and print out the pay for the week (including 1.5 times overtime pay for hours over 40). At the end, print the total pay for all employees. Some sample data is shown below (with the corresponding output). Hint: First write a while loop to read in employee data (one employee at a time) and print it. Then enhance your work to process an employee without overtime pay. Then include overtime pay and finally, produce the total pay.

The input and output can be “interlaced” as shown below. Your program must produce the exact Input/Output shown.

Input/Output:

Enter employee’s name: “John Smith”

Enter employee’s hours worked: 50

Enter employee’s hourly rate of pay: 10

John Smith’s pay=$550.00

Enter employee’s name: “Jane Doe”

Enter employee’s hours worked: 40

Enter employee’s hourly rate of pay: 15

Jane Doe’s pay=$600.00

Enter employee’s name: “Mark Manning”

Enter employee’s hours worked: 60

Enter employee’s hourly rate of pay: 12

Mark Manning’s pay=$840.00

Enter employee’s name: “zzzz “

Enter employee’s hours worked: 0 (this line is optional)

Enter employee’s hourly rate of pay: 0 (this line is optional)

Total pay=$1990.00

DUE DATE: October 26, 2014 @ 11:55pm

I would post my the picture of my visual logic program but it wont let me insert an image

You would waste more time on the silly costly flowchart. Python code is very readable, so the whole thing might look something like this:

print("Enter 'zzzz' as employee name to quit data entry loop ...\n")

pay_list = []
while True:
    emp = input("\nEnter employee's name: ")
    if emp == 'zzzz':
        break
    hrs = float(input("\nEnter employee's hours worked: "))
    rate = float(input("\nEnter employee's hourly rate of pay: "))
    if hrs <= 40:
        pay = hrs * rate
    else:
        pay = rate * 40 + (hrs - 40) * rate * 1.5
    pay_list.append(pay)
    print("\n{}'s pay = ${:.02f}".format(emp, pay))

print("\nTotal pay = {:0.2f}".format(sum(pay_list)))

@Chtaylor5201
employee’s
Strange to see a character (ascii 63) instead of the normal ' character (ascii 39).

Edited 2 Years Ago by vegaseat

This question has already been answered. Start a new discussion instead.