Due Date: Wed., 2019-09-18, and Thu., 2019-09-19 – Wed/Thu of week 04

The following guidelines are expected for all homework submissions:

Problems for Assignment #1

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.

  1. First, create the HighArray.java source 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.
  2. Compile that source code to make sure there are no errors.
  3. Create the HighArrayApp.java file in the same way. Compile that source as well, to make sure there are no errors. NOTE THIS IS A SEPARATE FILE – don't include this code in the same class file as HighArray.java, the way it is in the textbook!
  4. Compile the HighArrayApp.java source code to make sure there are no errors.
  5. Run the HighArrayApp program to ensure everything works properly.
  6. Now, to the HighArray class in the HighArray.java program, add a method called 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 the getMax() tests.
  7. Write a 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.
  8. Submit both your source code files to your repo. You only need to submit the source files, NOT THE CLASS FILES. THERE MUST BE TWO JAVA SOURCE FILES IN YOUR REPO FOR THIS ASSIGNMENT.