1) Define a class for an inventory item thatincludes the information Id, name, weight, color, number of units, and price.Suppose that, the information for Id and name MUST be PROVIDED WHEN an...


1) Define a class for an inventory item that includes the information Id, name, weight, color, number of units, and price. Suppose that, the information for Id and name MUST be PROVIDED WHEN an OBJECT for an inventory item is CREATED and this information CAN NEVER be CHANGED. Define a 2 parameter constructor in the class that takes the Id and name as parameters and assigns the values. Also, define a 3 parameter constructor in the class that takes the Id, name, and number of units as parameters and assigns the values. Both constructors MUST RESET the REMAINING FIELDS. Define get and set methods for fields other than Id and name. The program must create 4 objects for inventory item and apply some of the get and set methods to each object. The program must also show the contents of at least 2 objects after applying the get and set methods. A methodsuch as showInfo() may be defined for this purpose.



Jan 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here