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
- What is one social problem that is associated with modern families in the United States. From a functionalist perspective, choose the best research strategy to
- 1: Determine the Smallest # & Largest # & Range of these two numbers 1-2: Decide the number of classes 1-3: Determine the class interval or
- What is The Maltz Hierarchy of Sexual Interaction? What are the six levels of this? How can this model be useful? How can parents teach adolescents do