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, 21.06.2019 15:30
Which of the following is step 5 to the mail merge process
Answers: 3
question
Computers and Technology, 22.06.2019 22:00
What is the name of the option in most presentation applications with which you can modify slide elements? 1. the option enables you to modify a slide element in most presentation applications.
Answers: 3
question
Computers and Technology, 23.06.2019 17:00
In which of the following ways can using test-taking tips you? a. you can focus on the information that you need to study. b. you will see the answers to the test. c. you will study more. d. you will be less organized.
Answers: 1
question
Computers and Technology, 24.06.2019 12:10
What is it called during the editing process when the processor ensures that a character holding a coffee mug from one angle is holding the same mug in the same way when the shot switches to another camera at another angle? cinematography continuity technology prop use
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, 15.07.2019 15:10
question
English, 15.07.2019 15:10
question
Mathematics, 15.07.2019 15:10
Questions on the website: 13722363