Discuss the methods in java


Discuss the below:

Overview

This class comprises a component of a larger game. You have been asked to implement the structure that maintains a group of items contained within a backpack. Your task is to produce the central class that will reflect the inventory of a container in the game. You do not need to write any code but inside the Inventory.java file. You cannot change the method signatures or the class name. You simply need to fill in the details for each method in the Inventory.java class. You will be provided with the skeleton of the code as a starting point.

Data Structure

To make your life easier you will be provided with this API specification (just like the JavaDocs you use for your programming). You have a set of requirements

• You must use an Item array to store your Items in your Class.

• You are not permitted to use any collection Classes in this assignment.

• You must implement the entire class based on the API specification. This class will encapsulate all the functionality required.

• Each method javadoc will contain a list of the permissible method calls you must use only these method calls.

I have also left an indication of the length of a solution. Your solution could be shorter or longer its just an indication so that you can get an idea of how long "a" solution was. My calculation was done by counting every line (including close braces). All if/while/for loops had braces except error checking lines which had the return statement on the same line as the check. Eg if(x==false) return null; Comment lines also were not counted.

Testing

A test program (using junit, InventoryTest) is also provided for you to use. Please read it carefully. Use the test driver as a starting point to test your Class as thoroughly as possible. Note that the marker reserves the right to test more conditions if they think of them.

Note crafting your code to produce what the testing mechanism is expecting will get you a fail in the assignment. For example writing methods to just return fixed values.

I suggest you do your assignment in the following order

• Create all the method signatures in the Inventory Class. Each method should just be blank (with a return null, false or -1 if necessary).

• Compile and make sure that the program works (well, technically it won't because the methods are empty, but make sure it compiles with no errors).

• Write the addGold method. Test.

• Write the removeGold method. Test.

• Write the getGold method. Test.

• Write the increaseArray method. Test.

• Write the addItem method. Test.

• Write the numberOfItems method. Test.

• Write the decreaseArray method. Test.

• Write the indexOf method. Test.

• Write the removeItem -int- method. Test.

• Write the removeItem -String- method. Test.

• Write the itemAt method. Test.

• Write the buyItem method. Test.

• Write the getNumberOfItem method. Test.

• Write the indexOf method. Test.

• Write the rest of the methods. Test.

Note that when you add functionality you may have to add test scenarios to other test methods to ensure you have covered all the possibilities.

Requirement.

In addition to what is above there are a number of requirements for this assignment. Most of these are to introduce interesting problems for you to solve and must be obeyed.

• As you are programming you will also need to comment your code thoroughly in each of your methods.

• You are only permitted to use the the specified methods in the java doc comments for each method.

• The item array in your structure must always have only the space that is required.

• You may create additional methods (private only) but they are still constrained by the rules of the calling method

• You must not change the package name, class names, method names or the attributes of any of the classes.

Review the attachment:

Attachment:- Methods in java.rar

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Discuss the methods in java
Reference No:- TGS01800035

Expected delivery within 24 Hours