Unknown 00 and 0 create instance variables for name price


USE PYTHON 3 ONLY

1. Create a class Inventory.

2. Create attribute (class variable), totalInventory = 0.

4. Create an __init__ method has the following default values for name, price, quantity:

"Unknown", 0.0, and 0. Create instance variables for name, price, and quantity, and total (Hint: use self.total = 0).

Create the following attributes (instance variables) for the class:

String name # holds string data

price # holds floating point data

quantity # holds integer data

total # holds floating point data

5. Create a method named value_stock that will calculate the total as the quantity*price

6. Create a method __str__ that returns a string that displays the name and total.

7. Instantiate an object flash_drive_8gb with "USB Flash Drive", 12.99, and 40.

8. Call the value_stock method for the flash_drive_8gb object.

9. Print the flash_drive_8gb object

Solution Preview :

Prepared by a verified Expert
Business Management: Unknown 00 and 0 create instance variables for name price
Reference No:- TGS02281673

Now Priced at $45 (50% Discount)

Recommended (91%)

Rated (4.3/5)