Question: Someone please help me complete this. Thanks in advance! Assignment.cpp #include #include #include #include Hash.h using namespace std; int main() { string name, gender, inClass_or_onLine,

Someone please help me complete this.

Thanks in advance!

Assignment.cpp

#include  #include  #include  #include "Hash.h" using namespace std; int main() { string name, gender, inClass_or_onLine, major, campus, status, address, city; //a variable represents the number of hash table slots int count; //a variable represents the number of commands inside the input file int numOfCommand; //a variable represents the actual command name inside the input file string command; //declare any other necessary variables here //---- //get the first line which is a number and store it inside count cin >> count; //create a hash table with the 'count' number of slots //---- do { //get one line of student data //---- //Tokenize it to get each information out, then //insert the new student inside the hash table //---- //---- } while(//as long the line we read in is not "InsertionEnd"); cin >> numOfCommand; for(int i= 0;i < numOfCommand; i++) { //Get each line of the command //Tokenize it to extract the information //---- //base on the (command) you get { //if "hashDisplay": //Add your own codes to handle the case //---- //else if "hashSearch": //Add your own codes to handle the case //---- //else if "hashDelete": //Add your own codes to handle the case //---- //else cout<<"Invalid command" << endl; } }//end for return 0; }

LinkedList.h

#include  #include  #include  using namespace std; struct Student { string key; string name, gender, inClass_or_onLine, major, campus; string status, address, city; struct Student *next = NULL; }; class LinkedList { private: struct Student *head; int size; public: LinkedList(); ~LinkedList(); bool insert(string key, string name, string gender, string inClass_or_onLine, string major, string campus, string status, string address, string city); bool deleteStudent(string key); bool search(string key); void displayList(); int getSize(); }; //Constructor LinkedList::LinkedList() { head = NULL; size = 0; } //Destructor LinkedList::~LinkedList() { //Add your own codes here //---- //---- } //Return number of students inside the Linked list int LinkedList::getSize() { return size; } //Insert the parameter student at the head of the linked list. //return true if it is inserted successfully and false otherwise bool LinkedList::insert(string key, string name, string gender, string inClass_or_onLine, string major, string campus, string status, string address, string city) { //Add your own codes here //---- //---- } //Delete the student with the given key. //Return true if it is deleted successfully and false otherwise bool LinkedList::deleteStudent(string key) { //Add your own codes here //---- //---- if(//the student's key matches the parameter key) { cout << temp->name << " in "<< temp->major << " major, on " << temp->campus << " campus is deleted." << endl; //Add your own codes here //---- //---- return true; } //---- //---- } Hash.h 
#include  #include  #include  #include "LinkedList.h" using namespace std; class Hash { private: LinkedList **table; int m; public: Hash(int size); ~Hash(); bool hashInsert(string name, string gender, string inClass_or_onLine, string major, string campus, string status, string address, string city); bool hashDelete(string name, string gender, string major, string address); bool hashSearch(string name, string gender, string major, string address); void hashDisplay(); int h(string key); //Add any other necessary function declarations here //which you think are useful //---- //---- }; //constructor - create an array of LinkedList, m is the number of slots Hash::Hash(int size) { table = new LinkedList*[size]; m = size; } //Destructor - release the memory Hash::~Hash() { delete[] table; table = NULL; } //hashInsert inserts a student with the relevant info. into the hash table. //it returns true if the data is inserted successfully and false otherwise bool Hash::hashInsert(string name, string gender, string inClass_or_onLine, string major, string campus, string status, string address, string city) { //Add your own codes here //---- //---- } //hashDelete deletes a student with the relevant key from the hash table. //it returns true if it is deleted successfully and false otherwise //Note: key is the combination of name, gender, major and address bool Hash::hashDelete(string name, string gender, string major, string address) { //A bool variable used to check whether the student is deleted from //the hash table or not. bool deleted = false; //Add your own codes here //---- //---- if(!deleted) { cout << name << " with "<< major << " major, live at " << address << " is not found." << endl; } return deleted; } //This function searches for a key inside the hash table and //return true if it is found and false otherwise //Note: key is the combination of name, gender, major and address bool Hash::hashSearch(string name, string gender, string major, string address) { //A bool variable used to check whether the student is found //inside the hash table or not. bool found = false; //Add your own codes here //---- //---- if(found == false) cout << name << " with "<< major << " major, live at " << address << " is not found." << endl; return found; } //This function prints all students from the hash table. //check our sample output for the format void Hash::hashDisplay() { //Add your own codes here //---- //---- } //This is the hash function you will design and use //put clear comments here to let us know what kind of //hash function did you use //Hush function description: //---- //---- int Hash::h(string key) { //Add your own codes here //---- //---- }

 //This function searches the student with the given key //returns true if it is found, otherwise return false. bool LinkedList::search(string key) { //Add your own codes here //---- //---- } //This function displays the content of the linked list. //Check the sample output for output format void LinkedList::displayList() { //Add your own codes here //---- //---- }

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!