Question

CODING IN PYTHON: Assume a customer is at a store purchasing exactly 4 items. The cashier...

CODING IN PYTHON:

Assume a customer is at a store purchasing exactly 4 items. The cashier inputs the items and their prices into the computer. Someone has provided the cashier a Python program that does the following:

1. Asks cashier for name of each item (use short names like nails, paint, etc.)

2. Asks cashier for price of each item

A) Assume items are between $5 & $20. Have 1 item that is less than $10

3. Prints receipt header (see below for a sample receipt)

4. Prints item name and price as they are entered (Do this step four times, once for each product)

A) Input item name, item price, then print them

B) Keeps a running total

C) Keeps a running count of number of items purchased

5. Calculates and prints tax amount based on a certain tax rate

A) Use a CONSTANT to store tax rate

6. Prints a total that includes tax amount

7. Prints how much cash a person pays

A) Assume customer pays the exact or higher amount

8. Prints the amount of change (if any) to be returned to customer

Please note the following:

- Right-justify amounts

- Show $ signs

- Right justify items shown

- Leave plenty of blank lines in program for readability

- Have at least 4 - 5 comments

- Include pseudocode, englishcode, or flowchart (don’t need all, just one of the three)

SAMPLE RECEIPT

__ ITEMS PURCHASED

______________________________________

Item 1

$__.__

Item 2

$_.__

Item 3

$__.__

Item 4

$_.__

Total (for 4 items)

$__.__

Tax - _%

$_.__

Total (incl. tax)

$__.__

Customer Paid

$__.__

Change to customer, if any

$__.__

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

prices = []

for i in range(4):
print("Enter the price of Item %d:"%(i+1))
price = int(raw_input(""))
while(price <= 5 or price >= 25):
print("Enter the price of Item %d:"%(i+1))
price = int(raw_input(""))
  
prices.append(price)

tax = 15
total = sum(prices)
taxAmount = total*(tax/100.0)
totalWithTax = total + taxAmount

customerPaid = int(raw_input("Customer paid is: "))
changeToCustomer = 0
if (customerPaid > totalWithTax):
changeToCustomer = customerPaid - totalWithTax
print(" SAMPLE RECEIPT OF ITEMS PURCHASED\n Item 1: \t\t $.%.2f\n Item 2: \t\t $.%.2f\n Item 3: \t\t $.%.2f\n Item 4: \t\t $.%.2f\n\n Total(for 4 items)\t $.%.2f\n Tax-%d %%\t\t $.%.2f\n Total(icl tax)\t\t $.%.2f\n\n Customer Paid \t\t $.%.2f\n Change to Customer\t $.%.2f\n"%(prices[0],prices[1],prices[2],prices[3],total,tax,taxAmount,totalWithTax,customerPaid,changeToCustomer))

Output:

 SAMPLE RECEIPT OF ITEMS PURCHASED
 Item 1:                 $.10.00
 Item 2:                 $.20.00
 Item 3:                 $.22.00
 Item 4:                 $.15.00

 Total(for 4 items)      $.67.00
 Tax-15 %                $.10.05
 Total(icl tax)          $.77.05

 Customer Paid           $.80.00
 Change to Customer      $.2.95
Add a comment
Know the answer?
Add Answer to:
CODING IN PYTHON: Assume a customer is at a store purchasing exactly 4 items. The cashier...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need help building code in python for this: Create a program that: Creates a sales...

    I need help building code in python for this: Create a program that: Creates a sales receipt, displays the receipt entries and totals, and saves the receipt entries to a file Prompt the user to enter the Item Name Item Quantity Item Price Display the item name, the quantity, and item price, and the extended price (Item Quantity multiplied by Item Price) after the entry is made Save the item name, quantity, item price, and extended price to a file...

  • Assume that you are developing a billing software for a departmental store which sells electronic appliances,...

    Assume that you are developing a billing software for a departmental store which sells electronic appliances, clothing, and toys. The store offers discounts on a festival occasion as below: a) 20 % discount on electronic appliances whose prices are greater than or equal to $100 b) 30 % discount on clothing if the price of a clothing item is greater than or equal to $50 c) All the toys greater than or equal to $20 are subject to 10% discount....

  • You have to write a java solution for a store. Part 1 The solution needs to...

    You have to write a java solution for a store. Part 1 The solution needs to have at least following features: ◦ Item: Name, ID (incremental ID by 1 for each product), Price. ◦ Store Basket: ID (incremental ID by 1 for each basket), Net Amount, Total Amount, VAT, List of items, Date and Time of purchase, Address of the store, name of cashier. ◦ Cashier: Name, Surname, Username and Password (insert from code five fixed cashiers). ◦ Manager: Name,...

  • Assume that an imaginary supermarket sells items that are identified by a unique item number which...

    Assume that an imaginary supermarket sells items that are identified by a unique item number which is an integer in range 100 to 499 inclusive. The items are classified in four different categories based on their numbers, and each category defines a different sales tax rate. These four categories along with the range of item numbers included in them, and their specific sales tax rates has been summarized in the following table:    Category Item Numbers Sales Tax Rate A                100...

  • Write a Python program stored in a file q3.py that asks for the prices of items...

    Write a Python program stored in a file q3.py that asks for the prices of items and your money amount as input, and prints the options of items along with cost as output. Enter list of prices : 7 3 9 12 26 17 8 9 Enter dollar amount : 16 You have total 8 options Option 1: You can buy item 1 and item 2 with $10 .0. Option 2: You can buy item 1 and item 3 with...

  • A bathroom warehouse keeps the following information for the items in stock: O description(a string, for...

    A bathroom warehouse keeps the following information for the items in stock: O description(a string, for example "bath”) codeto distinguish between items with the same description and color but of a different design (a string to store 6 digits, for example "123456") color(a string, for example "white") numberin stock (an integer, for example 49) price(a floating point number, e.g. 349.95) 5.1 Write down the declaration for a structfor storing the information associated with one kind of item in stock. Give...

  • Use both pseudocode and flowcharts to solve the problems below: 1. Write a program that converts...

    Use both pseudocode and flowcharts to solve the problems below: 1. Write a program that converts a user-entered Fahrenheit temperature to equivalent Celsius temperature. Use the formula c = (5 / 9) * (f - 32) where c is representing a Celsius temperature and f a Fahreinheit temperature. 2. A program is required that will read two operands and print the product to a file. 3. A program will ask the user to enter his/her name. Upon entering the name...

  • QUESTION 5 14 marks A bathroom warehouse keeps the following information for the items in stock:...

    QUESTION 5 14 marks A bathroom warehouse keeps the following information for the items in stock: description(a string, for example "bath") codeto distinguish between items with the same description and color but of a different design (a string to store 6 digits, for example "123456") color(a string, for example "white") numberin stock (an integer, for example 49) price(a floating point number, e.g. 349.95) 5.1 Write down the declaration for a struct for storing the information associated with one kind of...

  • Write the following program in Java using Eclipse. A cash register is used in retail stores...

    Write the following program in Java using Eclipse. A cash register is used in retail stores to help clerks enter a number of items and calculate their subtotal and total. It usually prints a receipt with all the items in some format. Design a Receipt class and Item class. In general, one receipt can contain multiple items. Here is what you should have in the Receipt class: numberOfItems: this variable will keep track of the number of items added to...

  • In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast...

    In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast billing system. The program should do the following: Show the customer the different breakfast items offered by the restaurant. Allow the customer to select more than one item from the menu. Calculate and print the bill. Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item): Name Price Egg (cooked to order)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT