Question

Flowchart for Python program: Design and create a program for the ULM Coffee Shop to provide...

Flowchart for Python program: Design and create a program for the ULM Coffee Shop to provide some customer market research data. When a customer places an order, a clerk asks for the customer’s zip code and age. The clerk enters that data as well as the number of items the customer orders. The program operates continuously until the clerk enters a 0 for zip code at the end of the day. When the clerk enters an invalid zip code (more than 5 digits) or an invalid age (defined as less than 5 or more than 105), the program reprompts the clerk continuously until a valid entry is made. When the clerk enters fewer than 1 or more than 12 items, the program reprompts the clerk two more times. If the clerk enters a high value (greater than 12) on the third attempt, the program accepts the high value, but if the clerk enters a negative value on the third attempt, an error message is displayed, and the order is not processed further (not counted and not accumulated). At the end of the program, display a count of the number of items ordered by customers from the same zip code as the coffee shop (71209) and a count from all other zip codes combined. Display the overall average customer age.   Additionally, display the total counts of the number of items ordered by customers under 30 and by customers 30 and older.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
  • I have pasted fully working code below
  • I have also pasted a sample run of the code to test the code and attached the screenshots
  • The code contains one main method which does all the work specified and at the end the data is printed as specified in the question
  • In case of any doubts just comment down

------------------Screenshot-----------------

ksmukta:1z.python -> python a.py Zip code: 12 Age: 5 Enter number of items ordered: 12 Zip code: 71209 Age: 5 Enter number of

number of items ordered by customers from the same zip code as the coffee shop (71209): number of items ordered by customers

------------------Code------------------

OrdersByZip = [0,0]

OrdersByAge = [0,0]

coffee_shop_zipcode = "71209"

sum_age = 0

i = 0

def main():

global sum_age, i

print("Zip code:")

zipCode = raw_input()

while(len(zipCode)>5):

print("Zip code must not be more than 5 digits")

print("Zip code:")

zipCode = raw_input()

while(int(zipCode)!=0):

print("Age:")

age = int(raw_input())

while(age<5 or age>105):

print("Age must be within 5 years and 105 years")

print("Age:")

age = int(raw_input())

print("Enter number of items ordered:")

numItemsOrdered = int(raw_input())

if(numItemsOrdered<1 or numItemsOrdered>12):

print("Number of items ordered should be within 1 and 12")

print("Enter number of items ordered:")

numItemsOrdered = int(raw_input())

if(numItemsOrdered<1 or numItemsOrdered>12):

print("Number of items ordered should be within 1 and 12")

print("Enter number of items ordered:")

numItemsOrdered = int(raw_input())

if(numItemsOrdered<1 or numItemsOrdered>12):

print("Number of items ordered should be within 1 and 12")

print("Enter number of items ordered:")

numItemsOrdered = int(raw_input())

if(numItemsOrdered<1):

i -= 1

if(numItemsOrdered>=1):

sum_age += age

ind = 0 if(zipCode==coffee_shop_zipcode) else 1

ind2 = 0 if(age<30) else 1

OrdersByZip[ind] += numItemsOrdered

OrdersByAge[ind2] += numItemsOrdered

i += 1

print("Zip code:")

zipCode = raw_input()

while(len(zipCode)>5):

print("Zip code must not be more than 5 digits")

print("Zip code:")

zipCode = raw_input()

main()

print("number of items ordered by customers from the same zip code as the coffee shop (71209): " + str(OrdersByZip[0]))

print("number of items ordered by customers from all other zip codes combined: " + str(OrdersByZip[1]))

if(i>0):

print("overall average customer age: " + str(sum_age*1.0/i))

else:

print("overall average customer age: 0")

print("total counts of the number of items ordered by customers under 30: " + str(OrdersByAge[0]))

print("total counts of the number of items ordered by customers 30 or older: " + str(OrdersByAge[1]))

Add a comment
Know the answer?
Add Answer to:
Flowchart for Python program: Design and create a program for the ULM Coffee Shop to provide...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • disregard Final Project 2 Due Sunday by 11 59pm Points 100 Submitting the upload Instructions For...

    disregard Final Project 2 Due Sunday by 11 59pm Points 100 Submitting the upload Instructions For this assignment, you will create flowchart using Flowgorithm and Pseudocode for the following program example You are to design a program for Alexander's Coffee Shop providing customer research data When a customer places an order, the clerk asks the customer for their zip code and age. The clerk enters this data as well as the number of ems purchased. The program should operate continuously...

  • Question 1: A. Design a program using a flowchart or pseudocode that accepts a person’s loyalty...

    Question 1: A. Design a program using a flowchart or pseudocode that accepts a person’s loyalty card number and amount spent in the store last month. Display the date only if the customer is a high spender – a person who spent more than $1000 in the store. B. A program that accepts customer info continuously until a sentinel value is entered and displays a list of high spenders.

  • Mountain Coffee wants a program that allows a clerk to enter the number of pounds of...

    Mountain Coffee wants a program that allows a clerk to enter the number of pounds of coffee ordered, the price per pound, and whether the customer should be charged a 3.5% sales tax. The program should calculate and display the total amount the customer owes. Use an int variable for the number of pounds, a double variable for the price per pound, and a char variable for the sales tax information. a. Create an IPO chart for the problem, and...

  • in Python The program will compute and display information for a company which rents vehicles to...

    in Python The program will compute and display information for a company which rents vehicles to its customers. For a specified customer, the program will compute and display the amount of money charged for that customer’s vehicle rental. 1. The program will repeatedly prompt the user to enter the following four items for a given customer (in the specified order): a. The customer's classification code (a character) b. The number of days the vehicle was rented (a number) c. The...

  • Suppose that the amount of service(ordering a coffee and getting it done) time at a KU driving- through coffee shop is exponentially distributed with an expected value of 10 minutes. You arrive at th...

    Suppose that the amount of service(ordering a coffee and getting it done) time at a KU driving- through coffee shop is exponentially distributed with an expected value of 10 minutes. You arrive at the driving-through line while one customer is being served and one other customer is waiting in the line. The staff of the coffee shop informs you that the customer has already ordered a Cafe Latte and waited for 5 minutes. What is the probability that the customer...

  • This is Python The program should accept input from the user as either 7-digit phone number...

    This is Python The program should accept input from the user as either 7-digit phone number or 10-digit. If the user enters 7 characters, the program should automatically add "512" to the beginning of the phone number as the default area code. Dash (hyphen) characters do not count in input character count, but must not be random. If the user enters dashes the total character count must not exceed 12. The program should not crash if the user enters invalid...

  • Task 4: Coffee shop scheduling (9 marks total) 4. The Lakeside Coffee Shop morning customer load...

    Task 4: Coffee shop scheduling (9 marks total) 4. The Lakeside Coffee Shop morning customer load follows a normal distribution. The mean number of customers is 60 and the standard deviation is 15. a. Determine the probability that the number of customers tomorrow will be 50. (3 marks) b. If the store gets more than 70 customers, they need to have a fourth staff member working. What is the probability that they will need that fourth person tomorrow? (3 marks)...

  • Create a flowchart and a program; test the program. Program Requirements. - There are 10 members...

    Create a flowchart and a program; test the program. Program Requirements. - There are 10 members of the team. The program asks each member to enter their tennis rank.It only accepts an integer between 1 and 5 inclusive.. If the number entered is not valid, the program keeps prompting until a valid number is entered. The program calculates and prints the average rank. -Submit a photo of your flowchart and a screen shot of your python program.Test the Program: Check...

  • 6. At Pierre’s Coffee Shop, 65% of customers order coffee, 20% order tea, and 11% order...

    6. At Pierre’s Coffee Shop, 65% of customers order coffee, 20% order tea, and 11% order fruit juice, while 4% do not order anything to drink. In addition, 39% order a muffin, 26% order a bagel, and 23% order a Danish, while 12% do not order anything to eat. Finally, 8% of customers order both tea and a Danish, and 47% of people order fruit juice given that they have ordered a muffin. Assume that an individual customer will not...

  • You will create flowchart using Flowgorithm and Pseudocode for the following program example:&nbs...

    you will create flowchart using Flowgorithm and Pseudocode for the following program example:   Pet Care is a doggy day care that would like you to create a program that accepts the dog owner's name pet's name, breed, age and weight of the dog. The program should allow the user to enter this data until a sentinel value is reached. Then it will display the dog's name if the dog weighs less than 20 pounds or more than 100 pounds (be...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT