Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The flower.py has been deleted (unnecessary) I need help with the code in the python Supermarket.py. I need to change the input statements to read

The flower.py has been deleted (unnecessary)

I need help with the code in the python Supermarket.py. I need to change the input statements to read the file DaysOfWeek.txt. I need help to create 3-4 functions that are logical to better create a general outline of what the program is processing.(ie. Print headings, read file, etc.)

You will have to use the split function when reading in the file

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("\t" + 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: ") hoursTotal += int(hoursWorked) #add this to total hours worked prevDay = dayOfWeek

def dayChange(): #prints day total print("\t" + DAY_FOOTER + "\t" + prevDay + "\t" + str(hoursTotal)) while notDone == True: # Implement control break logic here # Include work done in the dayChange() function dayOfWeek = input("Enter day of week or done to quit: ") #prompt for day if dayOfWeek == SENTINEL: #if it is equal to done, break condition reached notDone = False #set not done to false else: hoursWorked = input("Enter hours worked: ") #else ask for hours worked if dayOfWeek != prevDay: #if newday detected, call function dayChange dayChange() prevDay = dayOfWeek #set prevday to dayOfWeek and hours total to hours worked hoursTotal = int(hoursWorked) else: hoursTotal += int(hoursWorked) #if day is continued, add to total hours print("\t" + DAY_FOOTER + str(hoursTotal))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

Explain how to build high-performance service delivery teams.

Answered: 1 week ago

Question

Understand what a service-oriented culture is.

Answered: 1 week ago