Question: Problem two - inventory(java) Createe two classes. The Inventory class and the TestInventory class. The Inventory class has two arrays. The first array is of

Problem two - inventory(java)

Createe two classes. The Inventory class and the TestInventory class.

The Inventory class has two arrays. The first array is of type String and is called PartName. It is of size 3. It contains: "Hammer", "Shovel","Brick".

The second array is of type integer. It is a 2 dimension array. It's name is PartCount. It is sized 2 columns by three rows. The 0th column of PartCount has values: 23, 33,100.The 1st column has three zeroes.

Creat a method in Inventory, called Update, that has a return type of zero and takes two arguments. The first argument is of type String and second is of type integer. Use the String argument to find the matching String in the PartName array. Use the index of the PartName value to update the 1stcolumn of the PartCount array.

Creat a second method that creates a report of the inventory called InventoryReport. It has a void return type $ takes no arguments. Once called, InventoryReport should display the PartName, the first and second column of PartCount and the difference of the two values in PartCount. For example it might display: Hammer 23 19 4Shovel 33 45 12 Brick 100 20 80.

The second class is TestInventory. It has a main method. It creates an object of type TestInventory. It asks the user for what Item to update and how many there are. It then calls the Inventory method Update, passing the two values. It asks the user if there are any more items to input and calls Update as needed. Once the user has no more updates, the program calls the InventoryReport method of the Inventory class.

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 Programming Questions!