1. Engineering
  2. Computer Science
  3. in c write a class the requirements for the class...

Question: in c write a class the requirements for the class...

Question details

In C++ write a class. The requirements for the class are define as followings:

Using the student class below create a StudentHash class

#include <iostream>

using namespace std;
class student
string first_name;
string last_name;
string middle_name;
int Student_ID;
cout<<"Enter first name=";
cout<<"Enter last name=";
cout<<"Enter ID=";
cout<<"Do you have Middle name(0 for no, 1 for yes)";
int n;
cout<<"Enter Middle name=";

  • Class StudentHash – This class will have the following methods with their signatures as listed below:
    • StudentHash (Constructor)
      • The constructor has one parameter. This parameter will be the maximum number of Student records that can be store in the hash table.
      • It will create and initialize the hash table.
    • Add()
      • This method will receive a Student record. It will try to insert the given Student record in the hash table that belongs to this class.
      • If the Student record is inserted successfully, it will return the collision index (C) as described in the insertion steps.
      • If the Student record cannot be inserted in the hash table, it will return (C * -1).
    • Search()
      • This method will receive the Student ID used to look up for a Student record previously inserted into the hash table.
      • If found, it will return the Student record.
      • Otherwise, it will return null.
    • PrintRecords()
      • This method has no input parameters.
      • It will display the Student record data that have been inserted in the hash table.
      • No return value from this function is needed.
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution