Microsoft Word - PA5.docx CPSC 2430 Winter 2021 Programming Assignment #5 Due date: Mar 15, XXXXXXXXXX:59pm DO NOT USE any of the STL (including the stack and queue type) in your code. Scheduling...

1 answer below »
please help on my C++ assignment


Microsoft Word - PA5.docx CPSC 2430 Winter 2021 Programming Assignment #5 Due date: Mar 15, 2021 11:59pm DO NOT USE any of the STL (including the stack and queue type) in your code. Scheduling Courses In Lab 5, you created a hash table of Courses without collision resolution. In this PA, you will implement hashing in a class called HashTable using separate chaining for collision resolution. The HashTable class should have a default constructor and a destructor. Copy constructor and copy assignment are not required. HashTable should have an array data member called schedule, which is explained further in the next section. Course and CourseNode Besides the HashTable class, this PA should have classes called Course and CourseNode. Each Course has the following data members. string title, date, time, instructor; int courseNo; The course number is used as a key, and the hash function takes the sum of the first two digits and the last two digits (ex. 2430 -> 24 + 30 -> 54). You can choose the initial table size based on the input file. Create default and parameterized constructors for Course that use an initialization list. Each cell in the schedule will point to a linked list of CourseNodes. Each CourseNode consists of an int (key), a Course (value), and a CourseNode ptr (next). The order of arguments for the constructor should match the input file. Read in all the courses in the SQ21.csv and add them to the schedule. You can start out with sample-schedule.csv for testing. HashTable Functions Implement the following functions: 1. void insert (long key, Course value): add the key-value pair to the table. If the key exists, tell the user that the course is already on the schedule. Otherwise, print the load factor after adding the course (ex. The load factor is 0.42). 2. string remove(long key): Remove the course and return the title of the course. If the course is not on the schedule, return an empty string. 3. void courseInfo(long key): If the key exists, display information about the course as shown in the execution example. Else, print that the course is not on the schedule. 4. void printAll(): displays the course number and the title of all the courses on the schedule. 5. void printIdx(int i): displays the course number and the title of all the courses at that index on the schedule. 6. int taughtOn(string day): displays the course information and returns the number of all the courses taught on that day. For example, a course taught on “MWF” should be shown when the user searches for “M”. Testing and submission Provide a driver/client program to demonstrate your functions. The user should be able to browse for courses, obtain more information about a course, and remove a course. View the execution example to see what the program might look like. Test ALL the functions of your class thoroughly in the driver, including all the edge cases. The Course class should be in two files named course.h and course.cpp. The HashTable class should be in two files named hash.h and hash.cpp. You can choose where to place CourseNode (in hash or in course). The driver should be in a file named pa5.cpp. Submit your program using the following command: /home/fac/hkong/submit/cpsc2430/submit_pa5 Execution example Using table size of 7 & sample-schedule.csv [pa5]./pa5 The course is already on the schedule. The course is already on the schedule. //load factors not printed for space purpose Hello! What would you like to do with the SQ21 schedule? 1. Print schedule, 2. Remove a course, 3. View course info, 4. Find a course by day, 5. Print index: 1 CPSC 1230 Programming and Data Types CPSC 1430 Programming and Problem Solving II CPSC 1000 Introduction to Computer Science CPSC 1100 Introduction to Computers & Applications CPSC 1220 Data-Driven Problem Solving & Programming CPSC 3200 Object-Oriented Development CPSC 2430 Data Structures CPSC 2600 Foundations of Computer Science CPSC 3300 Fundamentals of Databases CPSC 3400 Languages and Computation ************************* 1. Print schedule, 2. Remove a course, 3. View course info, 4. Find a course by day, 5. Print index: 2 Enter the course number of the course you want to remove: 1000 Removing "Introduction to Computer Science" from the schedule. ************************* 1. Print schedule, 2. Remove a course, 3. View course info, 4. Find a course by day, 5. Print index: 2 Enter the course number of the course you want to remove: 1234 That course is not on the schedule. ************************* 1. Print schedule, 2. Remove a course, 3. View course info, 4. Find a course by day, 5. Print index: 1 CPSC 1230 Programming and Data Types CPSC 1430 Programming and Problem Solving II CPSC 1100 Introduction to Computers & Applications CPSC 1220 Data-Driven Problem Solving & Programming CPSC 3200 Object-Oriented Development CPSC 2430 Data Structures CPSC 2600 Foundations of Computer Science CPSC 3300 Fundamentals of Databases CPSC 3400 Languages and Computation ************************* 1. Print schedule, 2. Remove a course, 3. View course info, 4. Find a course by day, 5. Print index: 3 Enter the course number of the course: 2600 CPSC 2600 - Foundations of Computer Science MWF 2:05-3:30pm Instructor: Prof. Dingle ************************* 1. Print schedule, 2. Remove a course, 3. View course info, 4. Find a course by day, 5. Print index: 4 Enter a day of the week: Th CPSC 1100 - Introduction to Computers & Applications TTh 6:00-8:05pm Instructor: Prof. Obare CPSC 3300 - Fundamentals of Databases TTh 1:30-3:35pm Instructor: Prof. Bae 2 course(s) taught on Th ************************* 1. Print schedule, 2. Remove a course, 3. View course info, 4. Find a course by day, 5. Print index: 5 Which index do you want to print? 5 CPSC 2430 Data Structures CPSC 2600 Foundations of Computer Science CPSC 3300 Fundamentals of Databases
Answered 1 days AfterMar 12, 2021

Answer To: Microsoft Word - PA5.docx CPSC 2430 Winter 2021 Programming Assignment #5 Due date: Mar 15,...

Ali Asgar answered on Mar 13 2021
157 Votes
//pa5.cpp
#include
#include "course.h"
Course::Course()
//Default Constructor | Assign All empty values
{
courseNum="";
title="";
date="";
time="";
instructor="";
courseNo=0;
}
Course::Course(string Cno, string titl, string dat,...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here