Design a Product class that models items in a small retail business. Use constructors, encapsulation, static members, and instance methods with logic to track inventory and pricing.
id
to each new Product object.
id using the static counter."Unnamed Product".0.0.0.id using the static counter.0.0.0.id, name, price, and stock.stock by amount if
amount > 0.
stock by amount if:
amount > 0, andamount ≤ stockpercent is
between 0 and 100. Price should never become negative.
[id] name - $price (Stock: stock) "T-Shirt", 19.99, 10).
Created products:[1001] T-Shirt - $19.99 (Stock: 10)[1002] Mug - $7.50 (Stock: 0)
Restocking Mug by 5...[1002] Mug - $7.50 (Stock: 5)
Selling 3 T-Shirts...[1001] T-Shirt - $19.99 (Stock: 7)
Applying 20% discount to T-Shirts...[1001] T-Shirt - $15.99 (Stock: 7)
Attempting to sell 10 Mugs...Not enough stock to complete sale.[1002] Mug - $7.50 (Stock: 5)
Total products created: 2