a. of a state in the United States are its name, capital, 8. area, year of admission to the union, and the order of admission to the union. Design the class stateData to keep track of the information for a state. Your class must include appropriate functions to manipulate the state's data, such as the functions setStateInfo, getStateInfo, and so on. Also, overload the relational operators to compare two states by their name. For easy input and output, overload the stream operators. Use the class hashT as described in the section, "Hashing: Implemen- b. tation Using Quadratic Probing," which uses quadratic probing to resolve collision, to create a hash table to keep track of each state's information. Use the state's name as the key to determine the hash address. You may assume that a state's name is a string of no more than 15 characters. Test your program by searching for and removing certain states from the hash table. You may use the following hash function to determine the hash address of an item: int hashFunc (string name) { int i, sum; int len; i = 0; sum = 0; len = name.length (); for (int k = 0; k < 15 - len; k++) name = name + ''; //increase the length of the na //to 15 characters for (int k = { 0; k < 5; k++) sum = sum + static cast (name[i]) * 128 128 + static_cast (name[i + 1]) * 128 + static_cast (name[i + 2]); i = i + 3; return sum % HTSIZ%;

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

C++

a.
Some of the attributes of a state in the United States are its name, capital,
8.
area, year of admission to the union, and the order of admission to the
union. Design the class stateData to keep track of the information for
a state. Your class must include appropriate functions to manipulate the
state's data, such as the functions setStateInfo, getStateInfo, and so
on. Also, overload the relational operators to compare two states by their
name. For easy input and output, overload the stream operators.
Use the class hashT as described in the section, "Hashing: Implemen-
tation Using Quadratic Probing," which uses quadratic probing to
resolve collision, to create a hash table to keep track of each state's
information. Use the state's name as the key to determine the hash
address. You may assume that a state's name is a string of no more than
b.
15 characters.
Test your program by searching for and removing certain states from the
hash table.
You may use the following hash function to determine the hash address
of an item:
int hashFunc (string name)
{
int i, sum;
int len;
i = 0;
0;
sum =
len
name.length ();
%3D
for (int k = 0; k < 15 - len; k++)
name = name + ' '; //increase the length of the name
//to 15 characters
for (int k = 0; k < 5; k++)
{
sum = sum + static cast<int> (name[i]) * 128 * 128
+ static_cast<int> (name[i + 1]) * 128
+ static_cast<int> (name[i + 2]);
i = i + 3;
return sum % HTSize;
}
Transcribed Image Text:a. Some of the attributes of a state in the United States are its name, capital, 8. area, year of admission to the union, and the order of admission to the union. Design the class stateData to keep track of the information for a state. Your class must include appropriate functions to manipulate the state's data, such as the functions setStateInfo, getStateInfo, and so on. Also, overload the relational operators to compare two states by their name. For easy input and output, overload the stream operators. Use the class hashT as described in the section, "Hashing: Implemen- tation Using Quadratic Probing," which uses quadratic probing to resolve collision, to create a hash table to keep track of each state's information. Use the state's name as the key to determine the hash address. You may assume that a state's name is a string of no more than b. 15 characters. Test your program by searching for and removing certain states from the hash table. You may use the following hash function to determine the hash address of an item: int hashFunc (string name) { int i, sum; int len; i = 0; 0; sum = len name.length (); %3D for (int k = 0; k < 15 - len; k++) name = name + ' '; //increase the length of the name //to 15 characters for (int k = 0; k < 5; k++) { sum = sum + static cast<int> (name[i]) * 128 * 128 + static_cast<int> (name[i + 1]) * 128 + static_cast<int> (name[i + 2]); i = i + 3; return sum % HTSize; }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY