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, 22.06.2019 10:50
Using least squares fitting, you are to fit the data sets to the following models and solve for the parameters ai , where i is the index of the parameter. the input/output data for the systems are linked in the bblearn site. for each of the systems use matlab to plot the supplied data vs. the model fit on one plot. include your code in the solutions. (a) linear fit "lineardata.mat" y=a1x^3 + a2x^2 + a3x + a4 (b) plant fit "plantdata.mat g(s) = a1/(s + a2)
Answers: 1
question
Computers and Technology, 22.06.2019 23:00
In which part of a professional email should you try to be brief, but highly descriptive?
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
What are some ways to use a range name in a formula? check all that apply. in the defined names group, click use in formula, and then select the desired name. begin typing the name in the formula, select a name from the autocomplete list, and use the arrow keys and tab key to enter the name in the formula. begin typing the formula, and then click and drag with the mouse to select the cells to include in the formula. right-click one of the cells in the range. click formula options, and use the dialog box to add the name.
Answers: 1
question
Computers and Technology, 23.06.2019 08:00
What is a scenario where records stored in a computer frequently need to be checked
Answers: 2
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
English, 15.06.2021 14:00
question
Biology, 15.06.2021 14:00
question
Mathematics, 15.06.2021 14:00
question
Mathematics, 15.06.2021 14:00
question
Mathematics, 15.06.2021 14:00
question
Chemistry, 15.06.2021 14:00