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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!