Question: In C++ please this is lab5.cpp the execuriom should look like: Do NOT use any of the STL in your code. For this lab, you


Do NOT use any of the STL in your code. For this lab, you should create a hash table that stores course titles (value) based on the corresponding course number (key). After downloading or copying lab5.cpp to your directory as written on Canvas, follow these steps: 1. Complete the Course class with data members string title and int courseNo. It should have a default and a parameterized constructor. 2. Create a hash table -a static array of Courses called schedule of size 7 - in the driver. 3. Write a basic hash function int hashFunc(int key) that returns a valid index. 3. Write an addCourse function that inserts a Course (the key-value pair) in the table based on the key. Return false if there is a collision. Otherwise, insert the course and return true. You will be dealing with collisions later in PA #5. 4. In the driver, insert all the key-value pairs from the key array (keyArr) and the value array(titleArr). The first title in titleArr should be paired with the first course number in keyArr, the second title with the second course number, and so forth. There are 15 values in each array. (Ex. CourseNo = 1000, Title = "Introduction to computer Science") If there is a collision, print a warning message. Keep a counter for the number of collisions as you insert all the key-value pairs. 5. Print the number of collisions and all the key-value pairs in the table. Check the execution example for the formatting. I will be testing your code with different courses. 6. Change the hash table size to get a better load factor and number of collisions. What happens when the array size is 10, 12, or 13? Write your answer at the top of your file. Submit your program by running the following script in the directory with your program: #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
