Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
- 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"
- If the user pays by cash, prompt them for the amount of cash to enter
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started