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 07:30
In the film "epic 2015," epic is the name for:
Answers: 3
question
Computers and Technology, 22.06.2019 17:30
Working on this program in python 3.7: a year in the modern gregorian calendar consists of 365 days. in reality, the earth takes longer to rotate around the sun. to account for the difference in time, every 4 years, a leap year takes place. a leap year is when a year has 366 days: an extra day, february 29th. the requirements for a given year to be a leap year are: 1) the year must be divisible by 42) if the year is a century year (1700, 1800, the year must be evenly divisible by 400some example leap years are 1600, 1712, and 2016.write a program that takes in a year and determines whether that year is a leap year.ex: if the input is 1712, the output is: 1712 is a leap year. ex: if the input is 1913, the output is: 1913 is not a leap year. your program must define and call the function isleapyear(useryear). the function should return true if the input year is a leap year and false otherwise.
Answers: 1
question
Computers and Technology, 23.06.2019 01:50
Create a class named majors that includes an enumeration for the six majors offered by a college as follows: acc, chem, cis, eng, his, phys. display the enumeration values for the user, then prompt the user to enter a major. display the college division in which the major falls. acc and cis are in the business division, chem and phys are in the science division, and eng and his are in the humanities division. save the file as majors.java.
Answers: 2
question
Computers and Technology, 23.06.2019 06:10
The head restraint should be adjusted so that it reaches a.the top of your ears b.the base of your skull c.the top of the head
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, 25.05.2021 04:10
question
English, 25.05.2021 04:10
question
English, 25.05.2021 04:10
question
Chemistry, 25.05.2021 04:10
Questions on the website: 13722360