Question: Question #5-Hash Table Implementation (30pts) Use the following steps to create a class called MyHash Table that will contain: An array of integers to store
Question #5-Hash Table Implementation (30pts) Use the following steps to create a class called MyHash Table that will contain: An array of integers to store the hash codes and a variable capacity to store the capacity of the array a) b) A constructor that initializes the capacity and the size of the array using a capacity generated by the nextPrime0 method c) The following methods: - insert0 inserts an element in the array.[Note: to make sure the index where the element will be stored is valid use element 90 capacity to generate the index) - clear: clears the array by recreating a new array - contain0 : returns true if the element is contained in the array - delete0: if the element exists stores a zero in the array. - isprime0 returns true if the number is prime. False if not - nextPrime0: generates the next prime number - PrintTable0 prints the hash table e) Use the following steps to create a class called TryMyHash Table to test out the MyHashTable you created above: -Use a Scanner to input the size of the hash table - Using a switch statement display a menu to perform the following operations in the hash table: 1. Insert, 2. Remove, 3. Contain and 4. Clear Use a loop to allow the user to perform all operations and print the hash table after performing cach operation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
