Question: Code in Java . I already wrote the Student Class (found below), but I'm having trouble with the rest of the implementation. Any help would


Code in Java. I already wrote the Student Class (found below), but I'm having trouble with the rest of the implementation. Any help would be appreciated!
public class Student { private String firstname; private String lastname; private int studentID; private String dob; private String data;
public Student() { this.firstname = ""; this.lastname = ""; this.studentID = 0; this.dob = ""; this.data = ""; }
public Student(String firstname, String lastname, int id, String dob, String data) { this.firstname = firstname; this.lastname = lastname; this.studentID = id; this.dob = dob; this.data = data; }
public String getfname() { return this.firstname; }
public String getlname() { return this.lastname; }
public int getID() { return this.studentID; }
public String getDOB() { return this.dob; }
public String getdata() { return this.data; }
public String toString() { return "[Student Info] [Name]: " + this.firstname + ' ' + this.lastname + " [ID]: " + this.studentID + " [Date of Birth]: " + this.dob + " [Data]: " + this.data; }
}
Doubly Hashed Linked list Student Database Suppose you have a collection of StudentAccount class objects. Each Student class contains two keys, first and last names, and some data associated with each student. You can use a random string for data. Student Record: O First name o Last name o Student ID o Date of birth (month, day, year) Random string data Key 1 - Student ID (string or int) Key 2 - Composite key using date of birth, first name, and last name. You need to create a data structure that supports efficient access using either of the two keys or by name. Since keys are unique, if you retrieve using the key, it should return single student object. Names are not unique. Multiple students can contain identical names, and retrieving student by name should return a list of student records that contain the same name string. Maintain the records in a single collection of items that is implemented using a linked list and two hash tables to allow quick access using either key. That means you have only one copy of the student records, but that collection is also accessible using the hash tables. You can use the Java collection classes to create the linked list and the hash tables. You do not have create the linked list of hash table classes. Your collection should contain the following methods. Add record - Adds the record to the collection and update both hash tables. It should update the record (update the data field) if there is already a record that matches both keys or add a new record if no such record exists. It should throw an exception if only one of the key matches or finds two separate records that match each key. Remove record - Remove the record from the collection. The record should be removed from the linked list and the keys should be removed from the two has tables. Get by name - Returns the list of records that contain name string in the first or last name. Use the string 'contains' method to check for the name. Returns an empty list if no matching records are found. Get by key - Returns the record with the corresponding key. You need two such methods, one for each key. Returns null if key not found. Print - Print all records in the collection. Create a tester class to test your implementation and show the full test output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
