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
- XYZ Ltd. is manufacturing three household products A, B and C and selling them in a competitive market. Details of current demand, selling price and cost
- Could u help me resolve this question? Assume the gold price is USD1500 per ounce, the nine-month interest rate is 3.25% p.a. and the gold lending rate is
- first: I want to know how to perform a kmeans cluster analysis in python using the variables FEV1 and FVC for mothers, fathers, and oldest children. where k=4