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...


C++


a.<br>Some of the attributes of a state in the United States are its name, capital,<br>8.<br>area, year of admission to the union, and the order of admission to the<br>union. Design the class stateData to keep track of the information for<br>a state. Your class must include appropriate functions to manipulate the<br>state's data, such as the functions setStateInfo, getStateInfo, and so<br>on. Also, overload the relational operators to compare two states by their<br>name. For easy input and output, overload the stream operators.<br>Use the class hashT as described in the section,
(name[i]) * 128 * 128 + static_cast (name[i + 1]) * 128 + static_cast (name[i + 2]); i = i + 3; return sum % HTSize; } "/>
Extracted 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=""> (name[i]) * 128 * 128 + static_cast (name[i + 1]) * 128 + static_cast (name[i + 2]); i = i + 3; return sum % HTSize; }

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here