Answered step by step
Verified Expert Solution
Question
1 Approved Answer
McCreary - Product Class In main.py define the Product class that will manage product inventory. Product class has three attributes: a product code, the product's
McCreary Product Class
In
main.py define the Product class that will manage product inventory. Product class has three attributes: a product code, the product's price, and the number count of product in inventory. Implement the following methods:
A constructor with parameters that sets all attributes to the value in the parameters
setcode self code set the product code ie SKU to parameter code
getcodeself return the product code
setpriceself price set the price to parameter price
getprice self return the price
setcount self count set the number of items in inventory to parameter count
getcount self return the count
add inventory self amt increase inventory by parameter amt
seltinventory self amt decrease inventory by parameter amt
Ex If a new Product object is created with code set to "Apple", price set to and the count set to the output is:
Name: Apple
Price:
Count:
Ex If apples are added to the Product object's inventory, but then are sold, the output is:
Name: Apple
Price:
Count:
Ex If the Product object's code is set to "Golden Delicious", price is set to and count is set to the output is: Name: Golden Delicious
Name: Golden Delicious
Price:
Count:
Hint: Ask yourself if this program asks for user input anywhere?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started