Chat with us, powered by LiveChat Background InformationSome stores are expensive; o - Writemia

## 21 Sep Background InformationSome stores are expensive; o

Background InformationSome stores are expensive; others are less so. Our mission is to generalize a grocery store into one of three categories: typical, cheap, or expensive. We’ll do this by going through each line of a receipt, and calculating the average cost of a single item including tax. Let’s say a “typical” store has an average cost of \$3 to \$5 for an item. If it’s less than that, we’ll call it “cheap,” and a higher average cost will get our “expensive” rating. Example Receipt: There are two entries. The first line shows 3 of some item (at \$4.25 ea) for \$12.75, and second is one item for \$6.90. Sales tax is 2.5 percent.Example Receipt Cruncher Calculation: 12.75 + 6.95 + \$0.4925 tax is \$20.1925. We have 4 items, and 20.1925 ÷ 4 is 5.048125, so we’d end up labeling that store as ‘expensive’ (just barely!)AssignmentWrite a Python program that prompts the user for the number of entries on a receipt, and then for each entry prompts the user for the number of items in that entry, followed by a prompt for the cost of the entry. Output the unit price of each item.After all of the entries have been entered, prompt the user to enter the sales tax (ex: 5.3)Calculate the average price per item, and output whether store should be considered typical, expensive, or cheap. If it’s answer is expensive or cheap, consider the sales tax, and explain that may have impacted the rank. (See below for details.)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 points35 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. (Look up how to round numbers in the Python documentation.)10 points – A function named get_rating is defined that takes four float parameters (item, lo, hi, tax) and correctly returns a rating as a string (e.g. ‘cheap’, ‘expensive’, or ‘typical’… or one of the outputs below…)NEW! in the case of an extra high tax (5% or more) or an extra low tax (less than 2%) output the following:(extra high tax): expensive, but you could blame that on the X% tax. (where X is the amount of the tax)(extra low tax): ‘cheap, but it helps that the sales tax is X%!’ (where X is the amount of the tax)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 TranscriptsHow many entries are listed on the receipt? 1Enter number of items in entry 1: 2Enter that entry’s total cost: 8Cost per item of entry 1 is: 4.0Enter sales tax (%): 4total cost (with tax): 8.32total number of items: 2average cost per item is 4.16That store seems typicalHow many entries are listed on the receipt? 1Enter number of items in entry 1: 2Enter that entry’s total cost: 9.98Cost per item of entry 1 is: 4.99Enter sales tax (%): 7.5total cost (with tax): 10.73total number of items: 2average cost per item is 5.36That store seems expensive, but you could blame that on the 7.5% tax.

Do you need an answer to this or any other questions?