subject
Computers and Technology, 20.04.2021 22:20 nev322

PLEASE DO THIS QUESTION IN PYTHON You will write two programs for this endeavor. The first will be a class definition module, and
the second will be the driver program. (Remember the naming rules for these modules!)
The class module should contain the following:
1. An initializer method that accepts two parameters (other than self):
a. A parameter corresponding to the name of the food
b. A parameter corresponding to the amount of the food (in pounds) to order
However, the initializer method should contain four hidden attributes:
a. The name of the food - to be updated using the food parameter
b. The amount in pounds - to be updated using the amount parameter
c. The standard price of the food item per pound - to be updated using a private
method
d. The calculated price of the ordered item (based on amount ordered) – to be
updated using a public method
2. A private method that will store the list of items and their price per pound (in other
words, the information provided in the table above). The method accepts no
parameters (other than self) and returns no value. Use an if-elif structure to set the
standard prices of the food. Reference the hidden attributes of food name and standard
price to set the prices.
Use the header of the method is (provided below) as well as the pseudocode to
complete this method:
#use this header (note the __ before the name)
def __PriceList(self):
if foodname is 'Dry Cured Iberian Ham' #write in actual python
then standardprice is 177.80
#complete the method…
Make sure to include a trailing else that sets the price to 0.00 if an item that is not on
the table is referenced (or if an item is misspelled J )
3. A public method to calculate the cost of the ordered food. The cost should be calculated
using the formula:
Amount of food (in pounds) x price per pound
The method accepts no parameters (other than self), but returns the calculated cost.
4. Accessors as needed (or an __str__ method if you prefer).
The driver program will import the class module you created. This module should contain the
following components:
1. A function that creates a list of objects. The function accepts no parameters but returns
the list of objects. The function should:
a. Create an empty list.
b. Prompt the user for the number of items. This value will be used to determine
the number of repetitions for a necessary loop. (Make sure to include input
validation to ensure that the number of items purchases is at least 1.)
c. Contain a loop that prompts the user for the name of the item and the amount
of the item in pounds. (Make sure to include input validation to ensure that the
number of pounds is greater than 0.) The loop should use this information to
create an object, and append the object to the list
d. Returns the list (once the loop is completed)
2. A function to display the contents of the list. This function accepts a list of objects as a
parameter but does not return a value. The function should:
a. display the contents of each object in the list (all 4 attributes). Make sure to
include appropriate formatting for prices.
3. A function that calculates the total cost of all items. Recall, your object will only have the
cost of each item (based on the amount of pounds ordered for that item). This function
accepts the list of objects as a parameter and returns a value. This function should:
a. access the individual cost of each ordered item
b. calculate the total cost of all the items in the list
c. return the total cost
4. A main function. Your main function should:
a. Call the three aforementioned functions
Dry Cured Iberian Ham $177.80
Wagyu Steaks $450.00
Matsutake Mushrooms $272.00
Kopi Luwak Coffee $317.50
Moose Cheese $487.20
White Truffles $3600.00
Blue Fin Tuna $3603.00
Le Bonnotte Potatoes $270.81

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 06:00
Which statistical function in a spreadsheet you to see how far each number varies, on average, from the average value of the list?
Answers: 2
question
Computers and Technology, 24.06.2019 15:30
What is the function of compilers and interpreters? how does a compiler differ from an interpreter?
Answers: 2
question
Computers and Technology, 25.06.2019 08:00
Astrategy for speeding up hard drive performance is
Answers: 2
question
Computers and Technology, 25.06.2019 20:30
Need five questions ! take your time~question 1 excel is a tool used to a create a spreadsheet b design a brochure c make a presentation d write a letter question 2 a cell on an excel spreadsheet refers to a a type of document view b a page of the workbook c the rectangular box where a column and row intersect d the data in a worksheet question 3 tanya is entering the amount of money she has earned from babysitting onto an excel spreadsheet, but the autocomplete feature is not working. why? a autocomplete must be turned on before every entry. b autocomplete only works with professional spreadsheets. c autocomplete does not recognize types of currency. d autocomplete only works when the first character is text. question 4 which tab has formatting features to change the font style, color, size, and alignment? a file b home c insert d view question 5 brad uses excel to create a weekly schedule. he wants to keep using the same spreadsheet every year. one of his rows is titled "baseball," but the season has ended until next year. what is the most efficient way to modify the spreadsheet, so brad does not see baseball on his schedule but can easily get it back when the season starts again? a add a new comment with the start date of the next season b hide the row and unhide it when the new season begins c highlight the row in a different color to show the season has ended d start a new spreadsheet
Answers: 1
You know the right answer?
PLEASE DO THIS QUESTION IN PYTHON You will write two programs for this endeavor. The first will be...
Questions
question
Mathematics, 20.03.2020 01:35
question
Advanced Placement (AP), 20.03.2020 01:36
Questions on the website: 13722363