Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: 1. Create a new Python code file named m3Pro_Purchases _L countastnameFirstname.py 2. This program is to display the count and total of items purchased.

image text in transcribed
Instructions: 1. Create a new Python code file named m3Pro_Purchases _L countastnameFirstname.py 2. This program is to display the count and total of items purchased. It is to also display the overall price of all items purchased after applying a 6% tax (0.06) and a 10% discount if more than 7 items are purchased. How should the program work? Instructions are provided below Items and their corresponding costs are shown in the image below. # List of stationary items Items= ["Pen"," Pencil ", "Eraser", "Sharpener", "Rule", "Marker", "Highlighter", "Scissors"] # List of corresponding prices Prices = [1.50, 0.75, 0.50, 0.85, 1.00, 1.25, 1.10, 2.50] Notice that both lists above reference the same number of elements. 3. In the program you created in step 1, add a main() function and define the lists shown in the image above in the main function 4. Next Create the functions defined in the table shown below Functions Description Input Return results Argument get purchase Literates over of items(products) -The list that Return two list (Items.prices) and does following: references One referencing the count the user purchases for each -Displays the items one at the the item time items(items The second referencing the total cost of each product Asks the user to enter count list shown -For example if only 4 pencils were bought, the function (number of units) they want to above) would return the following two list by for each item(product)and tem count=[0,7,0,0,0,0,0,0] keeps track of it -The list of Item cost [0,5.25,0,0,0,0,0,0] Calculate the total price for the prices for Hint:when referring to the items list show above, notice number of units purchased for each item that "Pencil" is the second item, hence the number of each product and keeps track of pencils and cost would be referenced in the same it. position in the two lists that this function will create Display This function is to display the following: -the list of items Doesn't return a litem count, list of the items -the list of prices value item cost) -unity price for each item -list of units bought for -the number of units bought for each item each product - the total cost for each item Listreferencing total price -The overall price for All the items bought for each item Hint Totalslitem count, -Calculate a 6% tax, adds it to the overall -List of units bought foe each product Doesn't return a Item cost total and display it List referencing total price for each item value Evaluate if the user purchased more than Thes are the obtained from the 7 items, if yes it applies the final price get purchase!) function Below is a screenshot that shows how the user input would collected (done the get purchase function) Item name: Pen How many would you like to buy? 2 Items name: Pencil How many would you like to buy? 5 Item name: Eraser How many would you like to buy? 6 The image bellow provide an example of what the output should look like Item Unit Price County Total Price Pen 1.5 2 $3.00 Penci 0.75 5 $3.75 Eraser 0.5 6 $3.00 Sharpener 0.85 10 $0.00 Ruler 1.0 8 $8.00 Marker 1.25 $1.25 Highlighter 1.1 13 $3.30 Scissors 2.5 $2.50 Overall Total $24.80 Tax $1.49 Total + Tax $26.29 Discount 10% $2.63 Final Price $23.66 Notice that part of the output is done by the display function and some by the totals function. Also note that Discount amount would only be calculated and displayed if the user purchased more than 7 items. Important: The output MUST be displayed in a tabular format similar to what is shown above. 5. The three functions defined above (get purchase, display and totals) above are to be saved in a DIFFERENT file (so all 3 functions in ONE file). give the file a discuptive name. 6. The main file is to reference the main function. The items and prices lists are to be created in the main function, the three other functions would also be called in the main function. ould be submitting a zipped folder

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

Which kind of lens is used to make a magnifying glass?

Answered: 1 week ago