Write program using data abstraction to track stock market

Assignment Help C/C++ Programming
Reference no: EM131978355

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 <iomanip>) 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

Reference no: EM131978355

Questions Cloud

Discuss the ethical dilemma jack faces : In 1 and 1/2 double-spaced pages discuss the ethical dilemma Jack faces. What is the issue? Who are the parties involved?
Indicative of normative influence : Imagine that some researchers conducted a study and interpreted the results of the study as indicative of normative influence.
Each machine have equivalent profit or loss : At what quantity does each machine have an equivalent profit or loss?
Name two positive outcomes of the growing pains : Name two positive outcomes of the growing pains developing nations go through in the transition to "industrialized" status, as well as two negative outcomes.
Write program using data abstraction to track stock market : Topic: C++ Assignment. You have decided to write a C++ program using data abstraction to help you keep track of the stock market
Equipment book value at the end of the project life : Create the depreciation schedule of the equipment. What is the equipment’s book value at the end of the project’s life?
Different from the general dictionary of learning : What makes it different from the general dictionary of learning? Why is it considered important to psychologists?
Ideas about human behavior and development : Describe the key ideas about human behavior and development for each of the five identified major perspectives in psychology.
What effect will this have on cash flows to equity : The entire principle was repaid at the end of year 10, what effect will this have on cash flows to equity? Explain

Reviews

len1978355

5/10/2018 5:19:07 AM

Topic: C++ Assignment. Detailed Question: This assignment needs to be performed on Linux. Required Submission File Structure - Do not change the structure of your project directory in any way. Do not rename files, add new files, or delete files. I grade your code using a Bash script that depends on files being in predictable places. Nothing in this assignment requires files to be moved, renamed, deleted, etc.

len1978355

5/10/2018 5:19:01 AM

Printed Output - Your code's printed output needs to be identical to the contents of the "correct output" file(s) provided as part of this assignment. "Identical" means the Linux utility diff will find no differences between your code's output and the provided file, when called with flags: -w -B. This means that the sequence of non-whitespace characters in your output has to be identical, but that differences in whitespace will be ignored.

len1978355

5/10/2018 5:18:56 AM

You are still required to produce output that lines up with itself properly. Columns may need to line up, numbers may need to be right-justified, etc. You should look at the "correct output" file(s) to see what you need to do. Each item sets the named data member to the value in the parentheses. In the SomeClass constructor above, each of the two initialization list items sets its data member to the constructor argument named inside the parentheses. This is weird-looking syntax, but it is standard usage in the culture of C++.

Write a Review

C/C++ Programming Questions & Answers

  A new business venture producing teddy bears

Peter Jones, is looking to set up a new business venture producing Teddy Bears. He has some good contacts in the retail sector and expects to be able to produce and sell 20,000 units per month, for the foreseeable future.

  Worst-case and best-case running times

a. Write a pseudocode for this algorithm. b. What are the worst-case and best-case running times for this sorting algorithm?

  Implemented a regular binary search tree

In Computer Science I, you implemented a regular binary search tree. Due to your busy schedule, you've decided that it would be best if you could simply reuse this code without any changes. You realize that your code would ONLY work for Arup's ass..

  Write recursive functions that perform insertion

Create a class called Board for use in playing the game tic-tac-toe. Recall that the game is played on a 3 x 3 board, where every square is either empty, or contains an "X" or an "O." The game is won when there are three X's or three O's in a st..

  Program- file input and file output

Write a program that asks the user to answer some questions. First, you should ask the user if they want to load answers from a previously saved file. What is your favorite color? How old are you

  Objectivein this assignment you read a list of employees

objectivein this assignment you read a list of employees from a csv file and convert them into corresponding objects.

  Explain the product or service and the location

Imagine that you own a business. Assume that this business is very successful. Dream about this for a minute. Then, briefly describe the business

  Implement a hotelroom class

Implement a HotelRoom class, with private data members: the room number, room capacity (representing the maximum number of people the room can accommodate), the occupancy status (0 or the number of occupants in the room), the daily room rate

  Tcp terminate the new connection

If a copy of the old FIN is delivered, will TCP terminate the new connection? Why or why not? Can a router send request to another router for TCP connection? Give reason.

  Problem regarding the relational algebra

A database records information about tutorials in a particular unit offering (such as ICT285 this semester). A student is supposed to attend only one of several available tutorials, each of which is taken by a tutor at a particular day and time. A..

  Definitions for object-oriented programming

Compare the definitions and compile them into one definition in your own words. Justify your answers using examples and reasoning.

  Boolean variable

Suggest one (1) example of a problematic programming situation or scenario that a Boolean variable could at least partially resolve. Justify your response

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd