Question: In java create a Product class. A Product object represents a product stored in inventory. The Product class should have the following private instance variables:
In java create a Product class. A Product object represents a product stored in inventory.
The Product class should have the following private instance variables: productName, numberOnHand, numberOnOrder, and price.
Give the instance variables public 'get' and 'set' methods. The numberOnHand, numberOnOrder, and price 'set' methods will not accept a negative number.
Give the class a four argument constructor that populates the data in a Product object. Also, recreate the no-argument constructor. Remember that the numberOnHand, numberOnOrder, and price should not be allowed to have a value less than zero.
Also give the class an overridden toString method that reports on the data in a Product object.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
