Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

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

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92816008

Have any Question?


Related Questions in C/C++

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As