Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ write a class. The requirements for the class are define as followings: Using the student class below create a StudentHash class #include using

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

Using the student class below create a StudentHash class

#include

using namespace std; class student { public: string first_name; string last_name; string middle_name; int Student_ID; student() { cout<<"Enter first name="; cin>>first_name; cout<<"Enter last name="; cin>>last_name; cout<<"Enter ID="; cin>>Student_ID; cout<<"Do you have Middle name(0 for no, 1 for yes)"; int n; cin>>n; if(n) { cout<<"Enter Middle name="; cin>>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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions