Write a class named RetailItem that holds data about an item in a retail store. The class should store the following data in attributes: item description, brand, units in inventory, and price. 2. Make sure you have getter and setter methods (accessor and mutator methods) for the class created. 3. The class is to have a method that properly displays object data when/if object is passed to the print function. Hint:__str__ 4. Create a program that creates three RetailItem objects and stores their information. 5. The information for the 3 objects you need to create is listed below: Description Brand Units in Inventory Unit Price Item #1 Jacket REI 12 130.95 Item #2 Designer Jeans Levi 40 34.95 Item #3 Shirt Nike 20 24.95 6. After storing the items as objects, calculate the total price for each item (units x unit price) then display the items as shown in the table above but with an additional column titled “Total Price” that displays the total price the program has calculated for each item. Image below shows how information is to be displayed PYTHON CODE FULL NO ERRORS
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Write a class named RetailItem that holds data about an item
in a retail store. The class should store the following data in
attributes: item description, brand, units in inventory, and price.
2. Make sure you have getter and setter methods (accessor and
mutator methods) for the class created.
3. The class is to have a method that properly displays object data
when/if object is passed to the print function. Hint:__str__
4. Create a
stores their information.
5. The information for the 3 objects you need to create is listed
below:
Description Brand Units in Inventory Unit Price
Item #1 Jacket REI 12 130.95
Item #2 Designer Jeans Levi 40 34.95
Item #3 Shirt Nike 20 24.95
6. After storing the items as objects, calculate the total price for each
item (units x unit price) then display the items as shown in the
table above but with an additional column titled “Total Price” that
displays the total price the program has calculated for each item.
Image below shows how information is to be displayed
PYTHON CODE FULL NO ERRORS
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images