Answered step by step
Verified Expert Solution
Link Copied!
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

  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.
  2. 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.
  3. Based on the input regarding payment method, your code should do the following:
    1. If the user pays by cash, prompt them for the amount of cash to enter
      1. 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"
      2. If the user enters an exact amount, display "Thank you for your purchase"
      3. 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!"
    2. If the user pays by credit card, display the amount charged to the credit card and the message "Thank you for your purchase"

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students explore these related Databases questions

Question

What Is acidity?

Answered: 3 weeks ago

Question

Explain the principles of delegation

Answered: 3 weeks ago

Question

State the importance of motivation

Answered: 3 weeks ago