posted 20 years ago
In the loop inside main(), you create a new Storage class for each iteration. Since each Storage has its own hashArray, each will store a single name_course in a single slot.
Instead, create a single Storage instance before the loop and store each name/course pair in the same Storage using a different slot. Given that the slot choice is random, I'm not sure how you'll go about doing it.
Also, since Storage is going to store name/course pairs, it probably shouldn't have name and course instance variables itself. I recommend creating a different class to represent a student's information (name and course).
Is the goal for this assignment to create your own hash table? If so, note that in a hash table, many objects may hash to the same slot.