Jun-17-2018, 12:44 AM
Output:Enter 1 to start a new sale
Enter 2 to view the total of all sales
Enter 3 to view the total tax collected
Enter 4 to view the quantity of each item sold
Enter 5 to view the average $ of all the transactions
Enter 6 to quit the program
Enter A for an apple sales
Enter G for a gas sale
Enter C for cookie sales
Enter Q to end the transaction and see the subtotal and total
The market sells only a few items:
Apples @ 99 cents each
Gas @ $3.59 per gallon
Cookies @ $1.99 per package (taxed)
Gum @ 99 cents per package (taxed)
Allow the user to keep entering in items until Q is entered.
Calculate the subtotal for the transaction without tax.
Calculate the total after adding 7% tax to the taxed items (see above).
Display the subtotal and total.
Keep a cumulative total of the quantity of each item sold.
Keep a record of each of the transactions.
After the user enters "Q" and quits the transaction, return to the main menu. Allow the user to view the total of all the sales (including tax), the total tax collected, the quantity of each item sold and the average sale (including tax). When the user enters 6, the program ends.
This is what I have so far but I can't figure how to plot the corresponding numbers or letters plus the grand total.print("Enter 1 to start a new sale.") print("Enter 2 to view the total of all sales.") print("Enter 3 to view the total tax collected.") print("Enter 4 to view the quantity of each item sold.") print("Enter 5 to view the average $ of all the transactions.") print("Enter 6 to quit the program.") print("Enter A for an apple sales: ") print("Enter G for a gas sale") print("Enter C for cookie sales.") print("Enter Q to end the transaction and see the subtotal and total.") grocery_item = {} grocery_history =[] tax_item =() stop = False while not stop: name = input("Item name:\n") quantity = input("quatity purchased:\n") cost = input("price per item:\n") tax_item = input("items with tax gum, cookie:\n") grocery_item = {"item name" :name, "quantity" :int(quantity), "cost" :float(cost), "tax" :floa(tax_item)} grocery_history.append(grocery_item) response = input("Do you need another item?\n 'y' for yes or 'q' to quit:\n") if response == 'q': stop = True grand_total = 0 for item in grocery_history: item_total = int(quantity) * float(cost) * float(tax_item) grand_total += item_total print(quantity, name, cost, tax_item, item_total) item_total = 0 print("Grand total: ", grand_total)