Question: In java , Write a program that keeps a map in which the keys of the map are objects of class Student. A student should

In java , Write a program that keeps a map in which the keys of the map are objects of class Student. A student should have a first name, a last name, and a unique integer ID. For the grade changes and removals, lookup should be by ID. Prompt the user of the program to add or remove students, to modify the grades, or to print all the grades. The printout should be sorted by last name. If two students have the same last name, then use the first name as a tie breaker. If the first names are also identical, then use the integer ID. Supply compatible hashCode and equals methods to the Student class. Test the hash code by adding the Student objects to a hash set.

Hint:

Usetwo maps.Calculates a hashcode by combining the hashcodes of the instance variables. @return a hashcode dependant on the instance variables */ public int hashCode() { final int HASH_MULTIPLIER = 29; int h = HASH_MULTIPLIER * firstName.hashCode() + lastName.hashCode(); h = HASH_MULTIPLIER * h + ((Integer)id).hashCode(); return h; }

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!