Topic c assignment you have decided to write a c program


Topic: C++ Assignment

You have decided to write a C++ program using data abstraction to help you keep track of the stock market. You want a program that will quickly allow your users to find out very quickly about a stock or mutual fund.

The information about each stock or mutual fund that you want to keep track of is:

  • ticker symbol (e.g., IBM for International Business Machines)
  • stock or fund name (e.g. International Business Machines)
  • share price (e.g. 25.73) (this should be stored as an int, not as a float or a double)
  • Date of that share price (e.g. May, 23, 1967)

You will implement this as a hash table. You will use linear probing for handling collisions. This means that if you have a collision when inserting a new item, you will search the table in order of increasing indices until you find the first empty slot and insert the new item there. You will treat the table as a circular array, so if your search takes you "off the top" of the table, you will continue looking for an empty slot at location zero.

An attempt to insert a stock into the hash table can fail for one of two reasons:

  • the stock is already in the hash table
  • the hash table is full (i.e. no more empty slots)

Your code will need to handle this condition by indicating failure when requested to insert a stock which is already there, or for which there is not room.

It is required that the functions HashMap::get(), HashMap::put(), and HashMap::remove() use hashing and linear probing. Do not just do a linear search in the array. Doing so will result in a severe loss of points.

The function HashMap::hashStr() should be coded to be as fast as possible and to not do unnecessary work as it computes the hash value for a string. Getting this right is non-obvious, and will be an important factor in your grade for this assignment.

The share price is required to be stored as an int (representing the number of cents, not dollars). You should not use any floating point techniques for either storing or printing out the share price.

Your code needs to produce output that's identical to the contents of asgmt03.correctOutput.txt (except for minor differences in whitespace). You will need to use I/O manipulators (defined in ) in order to format the printed output properly.

In the printed output, "hc" is the label for what your function returned as symbolHash, "hi" is the label for hashIndex, "ui" is the label for usedIndex, and "sl" is the label for the linear probe sequence length. The driver code takes care of printing all of this. Your code just has to return the appropriate data.

Attachment:- Assignment Files.rar

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Topic c assignment you have decided to write a c program
Reference No:- TGS02772824

Expected delivery within 24 Hours