Question

In: Computer Science

Using Python, write a program named hw3b.py that meets the following requirements: Welcome the user to...

Using Python, write a program named hw3b.py that meets the following requirements:

  1. Welcome the user to Zion's Pizza Restaurant and ask the user how many people are in their dinner group.
  2. If the answer is more than eight (8), print a message saying they'll have to wait for a table. Otherwise, report that their table is ready and take their order.
  3. Assume the client orders one pizza, and ask what he/she would like on their pizza, include a loop that prompts the user to enter a series of pizza toppings until they enter a quit value.
  4. As they enter each topping, print a message saying you’ll add that topping to their pizza.
  5. Make a list called sandwich_orders and fill it with the names of various sandwiches.
  6. Make an empty list called finished_sandwiches.
  7. Loop through the list of sandwich orders and spring a message for each order such as "I am working on your tuna sandwich"
  8. As each sandwich is made, move it to the list of finished sandwiches.
  9. After all the sandwiches have been made, print a message listing each sandwich that was made.
  10. Comment your code (with requirements above).

Solutions

Expert Solution

def get_size():
   party_size = input("How many people are in your dinner party tonight? ")
   party_size = int(party_size)

   if party_size > 8:
      print("I'm sorry, you'll have to wait for a table.")
   else:
      print("Your table is ready.")
      get_pizza_toppings()


def get_pizza_toppigns():
     toppings = []
     prompt = "\nWhat topping would you like on your pizza?"
     prompt += "\nEnter 'quit' when you are finished: "

     while True:
        topping = input(prompt)
        if topping != 'quit':
           print("  I'll add " + topping + " to your pizza.")
           toppings.append(topping) 
        else:
           break

def get_sandwich_order():
   sandwich_orders = ['veggie', 'grilled cheese', 'turkey', 'roast beef']
   finished_sandwiches = []

   while sandwich_orders:
       current_sandwich = sandwich_orders.pop()
       print("I'm working on your " + current_sandwich + " sandwich.")
       finished_sandwiches.append(current_sandwich)
 
   print("\n")
   for sandwich in finished_sandwiches:
       print("I made a " + sandwich + " sandwich.")

if __name__ = "main":
   get_size()
   get_sandwich_order()

Related Solutions

Using Python, write a program named hw3a.py that meets the following requirements: Create a dictionary called...
Using Python, write a program named hw3a.py that meets the following requirements: Create a dictionary called glossary. Have the glossary include a list of five (5) programing words you have learned in chapters 4-6. Use these words as keys to your dictionary. Find the definition of these words and use them as the values to the keys. Using a loop, print each word and its meaning as neatly formatted output. Create three dictionaries called person. Have each of the person...
Using Python, write a program that meets the following requirements: Make a list called sandwich_orders and...
Using Python, write a program that meets the following requirements: Make a list called sandwich_orders and fill it with the names of various sandwiches. Make an empty list called finished_sandwiches. Loop through the list of sandwich orders and spring a message for each order such as "I am working on your tuna sandwich" As each sandwich is made, move it to the list of finished sandwiches. After all the sandwiches have been made, print a message listing each sandwich that...
(CODE IN PYTHON) Program Input: Your program will display a welcome message to the user and...
(CODE IN PYTHON) Program Input: Your program will display a welcome message to the user and a menu of options for the user to choose from. Welcome to the Email Analyzer program. Please choose from the following options: Upload text data Find by Receiver Download statistics Exit the program Program Options Option 1: Upload Text Data If the user chooses this option, the program will Prompt the user for the file that contains the data. Read in the records in...
1. Write a Java program from scratch that meets the following requirements: a. The program is...
1. Write a Java program from scratch that meets the following requirements: a. The program is in a file called Duplicates.java that defines a class called Duplicates (upper/lower case matters) b. The program includes a Java method called noDuplicates that takes an array of integers and returns true if all the integers in that array are distinct (i.e., no duplicates). Otherwise it returns false. Make sure the method is public static. example tests: noDuplicates({}) returns true noDuplicates({-1, 1}) returns true...
Using Java, write a program named MyAngles that will prompt the user for the measure of...
Using Java, write a program named MyAngles that will prompt the user for the measure of the three sides of a triangle and then reports the measurement of each interior angle of the triangle and the area of the triangle.
Write a C program that meets the following requirements. Uses a while loop to display the...
Write a C program that meets the following requirements. Uses a while loop to display the first 10 natural numbers (on one row, with a tab separating each number) Uses a while loop to find the sum of the second set of 10 natural numbers. Reads a user entry and displays all the natural numbers up to the user entry (on a column list with a new line separating each number). Finds and displays the sum of all natural numbers...
Using Python Write a program that does the following in order: 1.     Asks the user to enter...
Using Python Write a program that does the following in order: 1.     Asks the user to enter a name 2.     Asks the user to enter a number “gross income” 3.     Asks the user to enter a number “state tax rate” 4.     Calculates the “Federal Tax”, “FICA tax” and “State tax” 5.     Calculates the “estimated tax” and round the value to 2 decimal places 6.     Prints values for “name”, “gross income” and “estimated tax” The program should contain three additional variables to store the Federal tax, FICA...
Using Python write a program that does the following in order: 1. Ask user to enter...
Using Python write a program that does the following in order: 1. Ask user to enter a name 2. Ask the user to enter five numbers “amount1”, “amount2”, “amount3”, “amount4”, “amount5” 3. Calculate the sum of the numbers “amount1”, “amount2”, “amount3”, “amount4”, “amount5” 4. If the sum is greater than 0, print out the sum 5. If the sum is equal to zero, print out “Your account balance is zero” 6. If the sum is less than 0, print out...
Program must use Python 3 Your program must have a welcome message for the user. Your...
Program must use Python 3 Your program must have a welcome message for the user. Your program must have one class called CashRegister. Your program will have an instance method called addItem which takes one parameter for price. The method should also keep track of the number of items in your cart. Your program should have two getter methods. getTotal – returns totalPrice getCount – returns the itemCount of the cart Your program must create an instance of the CashRegister...
Write a program in PYTHON, using a while loop, that asks the user to enter the...
Write a program in PYTHON, using a while loop, that asks the user to enter the amount that they have budgeted for the month. The program should then prompt the user to enter their expenses for the month. The program should keep a running total. Once the user has finished entering their expenses the program should then display if the user is over or under budget. The output should display the monthly budget, the total expenses and whether the user...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT