I have a question in pyhton :
1. class named RetailItem that holds data about an item in a retail store. The class should have an __init__ method that accepts the retail store's item description, units in inventory, and price as arguments. All the data attributes must be private, which means, they are available to only code inside the class
2. Write 3 statements that create three instances of RetailItem class (in question 1). The three instances should hold the data below.
Description Units in Inventory Price
Jacket 12 59.95
Designer Jeans 40 34.95
Shirt 20 24.95
3.class named PersonalData that holds data about an employee. The class should have an __init__ method that accepts the employee's ID number, name, and address as arguments. Write appropriate accessor and mutator methods for the class. All the data attributes must be private, which means, they are available to only code inside the class.
4.Write 3 statements that create three instances of the class PersonalData (in question 3). The three instances should hold the data below.
ID number Name Address
1001 John Doe 100 Main Street
2002 Jane Doe 200 Bell Drive
3003 <Your name> 11928 Stonehollow Drive
5. class named Car that has the following data attributes:
- __year_model (the car's year model)
- __make (the make of the car)
- __speed (the car's current speed)
The Car class should have an __init__ method that accept the car's year model and make as arguments. These values should be assigned to the object's __year_model and __make data attributes. It should also assign 0 to the __speed data attribute.
The class should also have the following methods:
- accelerate - The accelerate method should add 5 to the speed data attribute each time it is called.
- brake - The brake method should subtract 5 from the speed data attribute each time it is called.
- get_speed - The get_speed method should return the current speed.
-- Font family --
Comic Sans MS
Times New Roman
-- Font size --
Recently Asked Questions
- Please figure out if the following questions (a) through (d) are linear, time invariant, and causal
- Consider a sample with data values of17, 16, 20, 7, and 5. Compute the variance. (to 1 decimal) Compute the standard deviation. (to 2 decimals)
- b. What is the probability that a randomly selected applicant isor under? c. What is the probability that a randomly selected applicant is older than? d. What