Question: Assignment #1 Create a self checkout program that displays the total price for 3 supermarket items. Create inputs that ask for each items name and

Assignment #1

Create a self checkout program that displays the total price for 3 supermarket items. Create inputs that ask for each items name and price and associate variables with those inputs. After the user has finished inputting the names and prices of all items, display each item name, its price and the total price.

Sample output:

Bread - 4.50

Tomatoes - 1.99

Turkey - 6.99

Total - 13.48

Assignment #2

Supermarket Self Checkout, continued

Add the following to your existing self checkout code in Assignment #1:

  • In addition to asking for item names and prices from Assignment #1, update your code to ask the user for a quantity for each item.

  • After the summary of items/prices/quantities and the total amount displays, prompt the user for a payment method. The possible choices will be cash or credit card.

  • Based on the input regarding payment method, your code should do the following:

    • If the user pays by cash, prompt them for the amount of cash to enter

      • If the user enters an amount greater than the total, display the amount they entered, the change they should receive and the message "Thank you for your purchase"

      • If the user enters an exact amount, display "Thank you for your purchase"

      • If the user enters an amount less than the total, display "You have not paid the full amount. Your items will be returned to the shelves. Thank you!"

    • If the user pays by credit card, display the amount charged to the credit card and the message "Thank you for your purchase"

Assignment #3

Supermarket Self Checkout, cont'd

We will continue to build on the self checkout program by doing the following:

  • At the start of your supermarket program (from Assignment #1) ask the user if they are using Express or Regular checkout.

    • If the user chooses Express, they can enter 5 items OR LESS. Once the user enters their desired amount of items/prices/quantities, the program will execute the functionality we put in place for Assignment #2 (totaling the prices, asking for payment method, etc).

    • If the user chooses Regular, they can enter an unlimited number of items. Once the user enters their desired amount of items/prices/quantities, the program will execute the functionality we put in place for Assignment #2(totaling the prices, asking for payment method, etc)

I'm stuck with #3

this is what I have:

Express = '5' Regular = '>5' more = "Y"

while more == "Y" or more == "y": checkout = input("Will you do Express or Regular Checkout? ") Express = int(input("How many items? ")) if Express <=5: print("You may continue with express checkout.") break else: print("You may only purchase 5 items or less.") more= input("Continue with Regular Checkout? (Type Yes)")

item1 = input("What would you like to buy? ") item1Price = float(input("What is the price of " +item1+ "? ")) item1Qty = int(input("How many will you purchase? "))

item2 = input("What else would you like to buy? ") item2Price = float(input("What is the price of " +item2+ "? ")) item2Qty = int(input("How many will you purchase? "))

item3 = input("What else would you like to buy? ") item3Price = float(input("What is the price of " +item3+ "? ")) item3Qty = int(input("How many will you purchase? "))

total = (item1Price*item1Qty) + (item2Price*item2Qty) + (item3Price*item3Qty)

print(item1Qty, item1,"- $","{:.2f}".format(item1Price)) print(item2Qty, item2,"- $","{:.2f}".format(item2Price)) print(item3Qty, item3,"- $","{:.2f}".format(item3Price)) print("Total - $","{:.2f}".format(total))

#Customer will choose payment type method = input("How would you like to pay? (Cash or Credit) ")

if method == "Cash" or method == "cash" or method == "CASH": amount = float(input("Enter cash amount: $")) if amount > total: print("Your change is: $", ("{:.2f}".format(amount - total))," Thank you for your purchase.") elif amount == total: print("Thank you for your purchase.") elif amount < total: print("You have not paid the full amount. Your items will be returned to the shelves. Thank you!")

elif method == "Credit" or method == "credit" or method == "CREDIT": print("Thank you for your purchase.") else: print("Payment is not accepted.")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!