[Solved]-Question 2 40 Points Please Type Code Using Java Implement Hash Table Using Array Instead Q37195868
Question 2 (40 points) ( please type out the code 🙂 )
using java you are to implement a hash table using an array(instead of linked list) of 10 slots. Each slot can store an objectwhich contains 3 fields: The first is a student’s name (a 20-character string); The second is the student’s GPA (a real number);The third field holds the number of collisions that occur whileattempting to insert records into the hash table. Initially, thenumber of collisions is zero. You will need to increment it eachtime you probe the slot.
Your program should prompt the user on whether they need toenter a new student or quit. The student details are entered as aline that contains 2 fields: name and GPA. The 2 fields areseparated by one or more space characters. For example:
Do you want to enter a student? Yes
Jone 3.6
Do you want to enter a student? Yes
Dan 2.1
Do you want to enter a student? Yes
Matthews 4.0
Do you want to enter a student? Yes
Howard 4.0
Do you want to enter a student? Yes
Ford 4.0
Do you want to enter a student? No
Your program will
1.readinputandinsertitintoahashtableusingnameasthehashkey.
2. then, your program will print the entire hash table: name, GPAand the number of
collisions of each slot. Example output looks like:
SLOT. NAME GPA COLLISIONS
1 Winslow 2.1 2
2
3 Matthews 4.0 2
4 Hamlin 3.7 4
5 Daniels 3.9 2
6
7 Woods 3.1 0
8 Howard 4.0 0
9 Johns 3.3 1
10 Ford 4.0 0
Note: Your table traversal is arranged by slot number.Therefore, student names are not printed in alphabetical order. Ifa slot is empty, it’s line will be blank.
Your program then goes to the query mode: the user keys in aname, your program then looks up the hash table and prints out thestudent’s information.
Note: Please use comments in your program to document the hashand probing functions that you use in your program.
Expert Answer
Answer to Question 2 (40 points) ( please type out the code 🙂 ) using java you are to implement a hash table using an array (inst… . . .
OR

