Question: Java using data structures The objective of this assignment is to create your own Hash Table class to hold a list of employees and their

Java using data structures

The objective of this assignment is to create your own Hash Table class to hold a list of employees and their ID numbers. I've provided the TableEntry class which will be each data object in the hash table.

1) Your hash table class should have an array of TableEntry objects that store the key(id number) and value(name)

2) Use the Linear probing technique to handle collisions when you add or search the table

3) You hash function code should be in its own method, NOT in your main method.

You don't have to worry about removing data from the table or keeping track of Empty Since Start or Empty After Removal buckets. Treat all empty buckets as "Empty since start".

You must have these 3 classes: Main.java, HashTable.java, TableEntry.java

Flow of the main program:

Create an instance of your hash table class in the main class.

Read in the Employees.txt file and store the names and ID numbers in your hash table using the SIMPLE modulo operator (%) hash function that we covered in class: "key%N" where N is the size of your array.

After you stored all the data in the table, print out all the employee names and their corresponding id numbers.

Pick a random employee's ID number and then search for them in the hash table and retrieve their name, print it to the screen.

TableEntry.java is provided

TableEntry.java:

public class TableEntry {

private int key;

private String value;

TableEntry(int key, String value) {

this.key = key;

this.value = value;

}

public int getKey() {

return key;

}

public String getValue() {

return value;

}

}

must read in data from text file Employees.txt (No Whitespace between entries, just next line between entries)

Employees.txt:

135,John Peterman

160,Joe Divola

101,David Putty

68,Jerry Seinfeld

225,George Costanza

100,Elaine Benes

200,Cosmo Kramer

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!