Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Accumulating Totals in Single-Level Control Break Programs In this lab, you will

ID: 3572204 • Letter: A

Question

Accumulating Totals in Single-Level Control Break Programs

In this lab, you will use what you have learned about accumulating totals in a single-level control break program to complete a Python program. The program should produce a report for a supermarket manager to help her keep track of hours worked by her part-time employees. The report should include the day of the week and the number of hours worked for each employee for each day of the week and the total hours for the day of the week. The student file provided for this lab includes the necessary variable declarations and input and output statements. You need to implement the code that recognizes when a control break should occur. You also need to complete the control break code. Be sure to accumulate the daily totals for all days in the week. Comments in the code tell you where to write your code.

Study the prewritten code to understand what has already been done.

Write the control break code, including the code for the dayChange() function, in the main() function.

Execute the program using the following input values:

Monday—6 hours (employee 1)

Tuesday—2 hours (employee 1), 3 hours (employee 2)

Wednesday—5 hours (employee 1), 3 hours (employee 2)

Thursday—6 hours (employee 1)

Friday—3 hours (employee 1), 5 hours (employee 2)

Saturday—7 hours (employee 1), 7 hours (employee 2), 7 hours (employee 3)

Sunday—0 hours

------------------------------------------------------------------------------------------------------------------------------

# SuperMarket.py - This program creates a report that lists weekly hours worked
# by employees of a supermarket. The report lists total hours for
# each day of one week.
# Input: Interactive
# Output: Report.
# Declare variables.
HEAD1 = "WEEKLY HOURS WORKED"
DAY_FOOTER = "Day Total "
SENTINEL = "done"   # Named constant for sentinel value
hoursWorked = 0     # Current record hours
hoursTotal = 0      # Hours total for a day
prevDay = ""        # Previous day of week
notDone = True      # loop control

# Print two blank lines.
print(" ")
# Print heading.
print(" " + HEAD1)
# Print two blank lines.
print(" ")

# Read first record
dayOfWeek = input("Enter day of week or done to quit: ")
if dayOfWeek == SENTINEL:
    notDone = False
else:
    hoursWorked = input("Enter hours worked: ")
    prevDay = dayOfWeek

while notDone == True:
    # Implement control break logic here
    # Include work done in the dayChange() function
       
    print(" " + DAY_FOOTER + str(hoursTotal))

-----------------------------------------------------------------------------------------------------------------------------------

Test Results

0 / 6 passed0.00%

Score Calculation

Your score may be calculated from test case output, unit test performance, code keywords and / or the presence of issues in your code.

Test Cases

FAILED:

Sunday

Input

Output

Results

Day Total 0

Expected Output

Day Total 0

TIMED OUT:

Saturday

Input

Output

Results

Day Total 21

Expected Output

Day Total 21

TIMED OUT:

Friday

Input

Output

Results

Day Total 8

Expected Output

Day Total 8

TIMED OUT:

Thursday

Input

Output

Results

Day Total 6

Expected Output

Day Total 6

TIMED OUT:

Wednesday

Input

Output

Results

Day Total 8

Expected Output

Day Total 8

TIMED OUT:

Input / Output

Input

Output

Results

Day Total 6

Day Total 5

Day Total 8

Day Total 6

Day Total 8

Day Total 21

Day Total 0

Expected Output

Day Total 6

Day Total 5

Day Total 8

Day Total 6

Day Total 8

Day Total 21

Day Total 0

Super Marketpy track of hours worked by her part-time employees. The report should include the day of the week and the number of hours worked fo each employee for each day of the week and the total hours for the day ot the week. The student file provided for this lab includes the necessary variable declarations and input and output statements. You need implernent the code that recognizes when a control break should occur. You also need to complete the control break code. Be sure to accu the daily mulate totals for all days in the week. Comments in the code tell you where to write your code what has alre ady been done 2. Write the control break code ncluding he code for the dayChange0 function, in the nl function. 3. Execute the program using the following input values Monday 6 hours (employee 1) Tuesday-2 hours lemployee 11,3hours ployee 2 Wednesday 5 hour employee 1,3 hours employee 2 Thursday 6 hours (employee 1) yee 1,5 hours employee 2 Saturday 7 hours employee 1,7 hours (employee 2), 7 hours (employee 32 Sunday--0 hours Super Marketpy by employees of a upernarket eport list total hours for 3 each day of one ueek Declare vartables HEAD WEEKLY HOURS WORKED B DAY FOOTER Day Total NTINI done Harmed constant for sentinel value 1A hours Total total for a day 12 vDay nntDnne loop 14 t two blank 15 P 16 print ("VnIn t head 17 P 18 print("Vt" HEAD 19 Print two blank lines. 22 Read first record 23 day0fHeck input ("Enter day of ucck or done to quit SENTINEL 26 else Worked 27 28 prevDay dayofHrok 29 the day change() 32 32 34 print "It' I DAY FOOTER. I St oursTotal Run Code Theme Back Test Results Score Calculation ore may be calculated from test case output, ur test performance, code keywords and or the presenc Test Cases FAILED: Sunday TIMED OUT: Saturday TIMED OUT: Friday TIMED OUT: Thursday TIMED OUTi Wednesday TIMED OUT: Input output

Explanation / Answer

# SuperMarket.py - This program creates a report that lists weekly hours worked # by employees of a supermarket. The report lists total hours for # each day of one week. # Input: Interactive # Output: Report. # Declare variables. HEAD1 = "WEEKLY HOURS WORKED" DAY_FOOTER = "Day Total " SENTINEL = "done" # Named constant for sentinel value hoursWorked = 0 # Current record hours hoursTotal = 0 # Hours total for a day prevDay = "" # Previous day of week notDone = True # loop control days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] dayTotals = [0, 0, 0, 0, 0, 0, 0] # Print two blank lines. print(" ") # Print heading. print(" " + HEAD1) # Print two blank lines. print(" ") # Read first record dayOfWeek = input("Enter day of week or done to quit: ") if dayOfWeek == SENTINEL: notDone = False else: hoursWorked = input("Enter hours worked: ") prevDay = dayOfWeek while notDone == True: # Implement control break logic here # Include work done in the dayChange() function for i, day in enumerate(days): if day == dayOfWeek: dayTotals[i] += int(hoursWorked) print(" " + DAY_FOOTER + str(hoursTotal)) dayOfWeek = input("Enter day of week or done to quit: ") if dayOfWeek == SENTINEL: notDone = False else: hoursWorked = input("Enter hours worked: ") prevDay = dayOfWeek for i, hours in enumerate(dayTotals): if hours != 0: print(days[i]) print(hours)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote