Question: You will create a class to keep student's information: name, student ID, and grade. The program will have the following functionality: - The record is

You will create a class to keep student's information: name, student ID, and grade. The program will have the following functionality: - The record is persistent, that is, the whole registry should be saved on file upon exiting the program, and after any major change. - The program should provide the option to create a new entry with a student's name, ID, and grade. - There should be an option to lookup a student from his student ID (this will be the key in the hash table). - There should be an option to remove a particular entry by providing the student ID. - There should be an option to display the whole registry, sorted by student ID. - Remember that the registry must be persistent, so you will have to save all this information to the file system. You may use any of the versions of hash tables implemented in the previous exercise.

Here is my code for it so far, it might not be correct.

public class Student extends HashTable { private V name; private String id; private int grade; public V lookup() { HashTable registry = new HashTable(); Scanner input = new Scanner(System.in); System.out.print("Please Enter the Student ID: "); id = (String) input.next(); registry.lookup(id); java.lang.String out = "The Student's Name is " + name; return (V) out; } public V remove() { HashTable registry = new HashTable(); Scanner input = new Scanner(System.in); System.out.print("Please Enter the Student ID: "); id = (String) input.next(); super.remove(id); java.lang.String out = "The Student That Has Been Removed is " + name; return (V) out; } public java.lang.String display() { HashTable registry = new HashTable(); super.getSortedList(null); System.out.println(something); } public static void main(java.lang.String[] args) { HashTable registry = new HashTable(); Scanner input = new Scanner(System.in); java.lang.String choice; System.out.print(" What Would You Like to Do? Enter a Number:" + " 1. Lookup Student by ID" + " 2. Remove an entry with Student ID" + " 3. Display Registry "); switch (choice) { case "1": registry.lookupName(); case "2": registry.removeEntry(); case "3": registry.display(); } } }

The 'key' is the student id, and the 'value' is to call the object Student to get the name and letter grade.

I don't understand how to make the registry "persistent'.

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!