Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment Write a Python program that prompts the user for the number of entries on a receipt, and then for each entry, then prompts the

Assignment

  • Write a Python program that prompts the user for the number of entries on a receipt, and then for each entry, then prompts the user for the price of those items -- output the unit price of each item.
  • After all of the entries have been entered, prompt the user to enter the sales tax.
  • Calculate the average price per item, and output whether store should be considered typical, expensive, or cheap.
  • See the sample transcript below. You can assume that all user inputs will be valid when we test the program. Your solution should match the output format exactly.

Grading - 100 points

  • 35 points - The Average Cost Per Item calculation is correct.
  • 15 points - The user is prompted to enter the number of entries from the receipt (5 points), the price of each entry (5 points) and the quantity of items on each entry (5 points).
  • 10 points - With the exception of the actual average cost per item, the output format matches the output format of the transcript exactly (2 points for each type of difference up to 10 points).
  • 5 points - The average cost per item is displayed with two digits to the right of the decimal.
  • 10 points - A function named get_rating is defined that takes three float parameters (item, lo, hi) and correctly returns a rating as a string (e.g. "cheap", "expensive", or "typical").
  • 10 points - A function named main is defined (5 points). The only python statement that does not appear in this function or the translate function is the call to the main function, e.g. main() (5 points).
  • 10 points - The Python solution is easy to understand and does not contain unnecessary code (2 points for each type of improvement up to 10 points).
  • 5 points - An appropriate Python comment appears at the top of the submission. See below for the type of information that should appear.

Sample Python Header Comment

# --------------------------------------- # CSCI 127, Joy and Beauty of Data # Program 1: Receipt Cruncher # Your Name(, Your Partner's Name) # Last Modified: January ??, 2020 # --------------------------------------- # A brief overview of the program. # --------------------------------------- 

Sample Transcripts

How many entries are listed on the receipt? 1 Enter number of items in entry 1: 2 Enter that entry's total cost: 8 Cost per item of entry 1 is: 4.0 Enter sales tax (%): 4 total cost (with tax): 8.32 total number of items: 2 average cost per item is 4.16 That store seems typical

How many entries are listed on the receipt? 3 Enter number of items in entry 1: 4 Enter that entry's total cost: 12.84 Cost per item of entry 1 is: 3.21 Enter number of items in entry 2: 16 Enter that entry's total cost: 68.48 Cost per item of entry 2 is: 4.28 Enter number of items in entry 3: 2 Enter that entry's total cost: 44.50 Cost per item of entry 3 is: 22.25 Enter sales tax (%): 5.5 total cost (with tax): 132.7401 total number of items: 22 average cost per item is 6.03 That store seems expensive

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

Step: 3

blur-text-image

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

What will you do or say to Anthony about this issue?

Answered: 1 week ago