/* CSC 17 Lab 6 Part I: 2D Open Hash table For the first part of this assignment you are to implement a two-dimensional version of a hash table of students. You will use a 2D array of ArrayLists. Instead of one key and hash function you will need to implement two hash functions, hashA and hashB. The hashA value will determine the row coordinate of the array and the hashB function will determine the column. You will then implement three versions each of the search function, using either key or both keys to speed up the search as much as possible. You MUST implement the following interface: Make sure this file is in the same directory as your other files. */ public interface TwoDhash { public int hashA(int id); // hash function based on 700 number public int hashB(String name); // hash function based on name public void insert(student s); // insert new student record into table public student searchA(int id); // search by id; returns null if nonexistent public student searchB(String name); // search by name public student search(String name, int id); // search by both public student delete(String name, int id); public void printall(); // prints entire contents of table. } /* To get started, write another class in as SEPERATE file: import java.util.*; // need for ArrayList public class stuhash2D implements TwoDhash { ... } In the constructor of this class you will need to create an array of ArrayList objects. This needs to be done with the following kind of code. Assume H has been declared as of type ArrayList[][] and rows,cols are the dimensions of the array: H = (ArrayList[][]) new ArrayList[rows][cols]; for (int i=0;i(); You will get a compiler warning with this code but just ignore that for now - I'll explain later. */ /* The following main MUST WORK with your implmentation WITHOUT ANY CHANGE WHATSOEVER! ********************* public static void main(String[] args) { TwoDhash SH = new stuhash2D(100,100); SH.insert(new student("mary",700234123,3.5,1)); SH.insert(new student("larz",700555123,2.0,3)); SH.insert(new student("narx",700444223,2.8,0)); for(int i=0;i<10;i++) SH.insert(new student()); // random student student l = SH.searchA(700555123); SH.delete("larz",700555123); student m = SH.search("mary",700234123); student n = SH.searchB("narx"); System.out.println(l); System.out.println(m); System.out.println(n); SH.printall(); } */ /* --------- Part II --------- Following the example of the polymorphic *closed* hash table, make your code polymorphic. That is, the routines search, insert and delete should work with any hash table. The hashtables are parameterized by the value type and two key types (keyA and keyB). Use a parameterized abstract class such as public abstract class TwoKeyHash ... Then, redefine the hash table of students as a concrete subclass of TwoKeyHash. Furthermore, define *another* subclass of TwoDHash that uses a different pair of keys and hash functions. It's recommended that you place each class in an individual file. Place all related files into a separate folder. */