Lab Scenario: 1. The program uses a loop to repeatedly get an item from the user....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Lab Scenario: 1. The program uses a loop to repeatedly get an item from the user. This should be in the "global code" section of the file. 2. On each iteration of the loop, the program ask the user for the following: a. the item name b. if the item is a food item c. if it's not a food item, ask if it's a medicine item d. the item price 3. Based on the user responses, the program will compute the tax for the item using a tax() function you write. The tax function should have parameters for price and category. Category may be 'food', 'medicine', or 'general'. The category parameter should default to 'general'. The tax() function should return: a. price* .025 when the category is 'food' (tax on food is 2.5%) b. O when the category is 'medicine' (there is no tax on medicine) c. price*.06 when the category is 'general' (tax on other items is 6%) 4. The program should maintain a list named receipt where each entry in the list is a list or tuple containing an item name, price, and extended price (meaning the price plus the tax). After you have gotten all input for an item, add a new entry to receipt for that item. 5. After adding the entry to receipt, prompt for whether the user would like to enter another item. If so, execute the loop body again. 6. When the user indicates they do not want to enter any more items, call a print_receipt() function to print a nicely-formatted receipt. This function should take one parameter of the type described for receipt above. The printed receipt should contain a header with the headings 'Item', 'Price', and 'Extended Price'. Under the header, each row should list the item name, price, and extended price for a single item, formatted as nicely as you can. (Use a for loop to iterate through each entry in the big list and print the row for that entry.) After all items are printed, leave a blank line and then print 'Total', followed by the total of all extended prices, lined up as well as you can under the individual item extended prices. (Note that all prices and extended prices should be printed with dollar signs and exactly two decimal places.) 7. For this lab, you are expected to define at least the following two user-defined functions. You may define additional functions if you wish, but you must include and use at least these two, as described above: a. tax(): see #3 above b. print_receipt(): see #6 above Submission: 1. All submissions will be via Blackboard. Please see assignment in this module. 2. Your accepted sources for obtaining help: module resources, textbook, course instructor and GTA 3. The code needs to be written in the firstname_lastname_LA5.py template file. Please change the name of the file and the header of the file. Example File name: Jane_Doe_LA5.py Sample input/output: *** Thank you for using self-checkout *** Enter item name: water Is this a food item? (y/n): y Enter price: $2 Enter another item? (y/n): y Enter item name: aspirin Is this a food item? (y/n): n Is this a medicine item? (y/n): y Enter price: $11.99 Enter another item? (y/n): y Enter item name: tissues Is this a food item? (y/n): n Is this a medicine item? (y/n): n Enter price: $3.99 Enter another item? (y/n): n Item Price water $2.00 aspirin $11.99 tissues $3.99 Total Extended Price $2.05 $11.99 $4.23 $18.27 Lab Scenario: 1. The program uses a loop to repeatedly get an item from the user. This should be in the "global code" section of the file. 2. On each iteration of the loop, the program ask the user for the following: a. the item name b. if the item is a food item c. if it's not a food item, ask if it's a medicine item d. the item price 3. Based on the user responses, the program will compute the tax for the item using a tax() function you write. The tax function should have parameters for price and category. Category may be 'food', 'medicine', or 'general'. The category parameter should default to 'general'. The tax() function should return: a. price* .025 when the category is 'food' (tax on food is 2.5%) b. O when the category is 'medicine' (there is no tax on medicine) c. price*.06 when the category is 'general' (tax on other items is 6%) 4. The program should maintain a list named receipt where each entry in the list is a list or tuple containing an item name, price, and extended price (meaning the price plus the tax). After you have gotten all input for an item, add a new entry to receipt for that item. 5. After adding the entry to receipt, prompt for whether the user would like to enter another item. If so, execute the loop body again. 6. When the user indicates they do not want to enter any more items, call a print_receipt() function to print a nicely-formatted receipt. This function should take one parameter of the type described for receipt above. The printed receipt should contain a header with the headings 'Item', 'Price', and 'Extended Price'. Under the header, each row should list the item name, price, and extended price for a single item, formatted as nicely as you can. (Use a for loop to iterate through each entry in the big list and print the row for that entry.) After all items are printed, leave a blank line and then print 'Total', followed by the total of all extended prices, lined up as well as you can under the individual item extended prices. (Note that all prices and extended prices should be printed with dollar signs and exactly two decimal places.) 7. For this lab, you are expected to define at least the following two user-defined functions. You may define additional functions if you wish, but you must include and use at least these two, as described above: a. tax(): see #3 above b. print_receipt(): see #6 above Submission: 1. All submissions will be via Blackboard. Please see assignment in this module. 2. Your accepted sources for obtaining help: module resources, textbook, course instructor and GTA 3. The code needs to be written in the firstname_lastname_LA5.py template file. Please change the name of the file and the header of the file. Example File name: Jane_Doe_LA5.py Sample input/output: *** Thank you for using self-checkout *** Enter item name: water Is this a food item? (y/n): y Enter price: $2 Enter another item? (y/n): y Enter item name: aspirin Is this a food item? (y/n): n Is this a medicine item? (y/n): y Enter price: $11.99 Enter another item? (y/n): y Enter item name: tissues Is this a food item? (y/n): n Is this a medicine item? (y/n): n Enter price: $3.99 Enter another item? (y/n): n Item Price water $2.00 aspirin $11.99 tissues $3.99 Total Extended Price $2.05 $11.99 $4.23 $18.27
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Determine in each situation when capital investment analysis would be used. Purchase of a new delivery truck, which has an estimated useful life of five yearsDetermine if each statement would relate...
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Ivanhoe Company was formed on July 1, 2018 It was authorized to issue 285,500 shares of $10 par value common stock and 95,400 shares of 8 $25 par value, cumulative and nonparticipating preferred...
-
Suppose the airplane of Prob. 7.116 takes off at sea level without benefit of flaps and with constant lift coefficient and take-off speed of 100 mi/h. (a) Estimate the take-off distance if the thrust...
-
In Problems, sketch the region R bounded by the graphs of the given equations and show a typical horizontal slice. Find the volume of the solid generated by revolving R about the y-axis (a) x = y2, x...
-
Frosting of evaporator tubes results in (a) increased heat transfer rate (b) decreased heat transfer rate (c) increased compressor pressure (d) decreased compressor pressure
-
The following is an alphabetical list of accounts for the Mack Company: Accounts payable Accounts receivable Accumulated depreciation, Buildings and office equipment Accumulated depreciation, Store...
-
A 16-year-old girl by the name of Jenny Foster was found hitch-hiking along the Adirondack Mountains Highway in upstate New York. Mr. David Sykes, a driver on the highway, stopped to pick up the...
-
Exercise 3 used GSS data on the number of hours worked per week for a sample of 32 Latino adults. a. Calculate the mean number of hours worked per week. b. Compare the value of the mean with those...
-
Discuss this view taking into account the alternative international strategies available to organizations. This question relates to lecture topic 6 on International Strategy Choices and requires to:...
-
Suppose you are advised to use the following risk metric V, which one may name Median Shortfall: P(R -V|R
-
An airline tracks data on its flight arrivals. Over the past six months, 70 flights on one route arrived early, 150 arrived on time, 15 were late, and 25 were canceled. What is the probability that a...
-
Consider the following long-run model of an economy: On the supply side, long-run aggregate supply, Y, is produced according to the following technology: Y = A(K) (I)/2 where the technology parameter...
-
Solve For x 2x-7 x+8 3 = + 5 7
-
1 Sales budget Quarter Ending 2021 Production budget Quarter Ending 2021 Direct Material (s) budget quarter ending 2021 Direct Labor Budget quarter ending 2021 Manufacturing Overhead Budget quarter...
-
Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1? A. rem 3.14% 2.1; B. rem modf (3.14, 2.1); C. rem fmod(3.14, 2.1); D. Remainder cannot be obtain in...
-
Read Case Study Google: Dont Be Evil Unless and answer the following: Why do you think Google was adamant about not wanting to supply information requested by the government concerning the Child...
-
Quince Corporation has taxable income of $450,000 for its 2012 calendar tax year. Calculate the corporation's income tax liability for 2012 before tax credits. $_________
-
Quince Interests is a partnership with a tax year that ends September 30, 2012. During that year, Potter, a partner, received $3,000 per month as a guaranteed payment, and his share of partnership...
-
Russell (age 50) and Linda (age 45) Long have brought you the following information regarding their income and expenses for the current year. Russell owns and operates a landscaping business called...
-
What does the Richter scale measure?
-
Where do earthquakes occur?
-
Why do earthquakes produce seismic waves?
Negotiation Mastery Tools For The 21st Century Negotiator 1st Edition - ISBN: 1780922566 - Free Book
Study smarter with the SolutionInn App