Computers and Technology
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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, alowery89
Match the steps of the process to julia's analysis. 1. analyze choices. current costs for making phone calls to foreign countries averages between five and ten cents a minute. 2. determine the goals. julia needs to reduce the cost of telecommunications without reducing her employees' ability to do their jobs. 3. gather data. the corporate computer network will be able to handle the increased traffic that will occur as a result of voip. 4. evaluate the decision. julia will have her it department set up voip in the smallest domestic office. 5. make the decision. julia will have employees document the benefits and problems that result from using the new technology.
Answers: 1
image
Computers and Technology, 23.06.2019 22:30, ghari112345
Jamie has to enter the names, employee id’s, and income of a group of employees into a worksheet. which option will jamie use to describe the data
Answers: 3
image
Computers and Technology, 24.06.2019 00:20, danielmartinez024m
The guy wire bd exerts on the telephone pole ac a force p directed along bd. knowing the p must have a 720-n component perpendicular to the pole ac, determine the magnitude of force p and its component along line ac.
Answers: 2
image
Computers and Technology, 24.06.2019 16:50, genyjoannerubiera
Ramp charts are generally created in wordlotusexcelpowerpoint
Answers: 1
Do you know the correct answer?
PLEASE DO THIS QUESTION IN PYTHON You will write two programs for this endeavor. The first will be...

Questions in other subjects:

Konu
Mathematics, 15.02.2020 05:48