The following guidelines are expected for all homework submissions:
all over the mapon my computer or printer. USE SPACES INSTEAD. You can set up almost every modern text editor to insert spaces whenever you press the TAB key, or you can simply pound the spacebar.
pair programmingwhich is part of the Extreme Programming software development method. Feel free to collaborate in your pairs as much as you want, doing the entire assignment together.
You will be using the
HighArray class from the textbook for this homework assignment. This class
uses an array and demonstrates insertion, deletion, and location operations. The implementation is not
too difficult. The base class file (Listing 2.3) is on pages 49-50. There is a separate class that
contains the main method for this program, called
HighArrayApp which begins at the bottom of page
50. Your task is to use these two classes to implement the following projects.
HighArray.javasource file. Be sure to use good coding practices to make your code pretty, artful, and maintainable. You can copy and paste the source code from the text book, which will make your life easier.
HighArrayApp.javafile in the same way. Compile that source as well, to make sure there are no errors. NOTE THIS IS A SEPARATE FILE!
getMax()that returns the value of the highest key in the array, or –1 if the array is empty. Add some code in the
main()method in the HighArrayApp.java to test this method. You can assume all the keys are positive numbers. Add AT LEAST five new test cases, which means you will need to add or remove values from the array between calls to
noDups()method for the HighArray class of the HighArray.java program. This method should remove all duplicates from the array. That is, if three items with the key 17 appear in the array,
noDups()should remove two of them. Don’t worry about maintaining the order of the items. One approach is to first compare every item with all the other items and then overwrite any duplicates with a null [(]or a distinctive value that isn’t used for real keys]. Then remove all the nulls. Of course, the array size must be reduced correctly.