Write a program to help a local stock trading company

Assignment Help Programming Languages
Reference no: EM13762602

Your program must consist of at least four (4) source files - two .h files and two .cpp files. Each major class must be described in a separate .h file. There must be no implementation code in the .h files - they should consist solely of declarations. There must be (at least) one .cpp file corresponding to each .h file - they should contain the definition

Write a program to help a local stock trading company automate its systems. The company invests only in the stock market. At the end of each trading day, the company would like to generate and post the listing of its stocks so that investors can see how their holdings performed that day. We assume that the company invests in, say, 10 different stocks. The desired output is to produce two listings, one sorted by stock symbol and another sorted by percent gain from highest to lowest.

The input data is provided in a file in the following format:

Symbol openingPrice closingPrice todayHigh todayLow prevClose volume

For example, the sample data is:

MSMT 112.50 115.75 116.50 111.75 113.50 6723823

CBA 67.50 75.50 78.75 67.50 65.75 378233

The first line indicates that the stock symbol is MSMT, today's opening price was 112.50, the closing price was 115.75, today's high price was 116.50, today's low price was 111.75, yesterday's closing price was 113.50, and the number of shares currently being held is 6723823.

The listing sorted by stock symbols must be of the following form:

Develop this programming exercise in two steps. In the first step (part a), design and implement a stock object. In the second step (part b), design and implement an object to maintain a list of stocks.

Part a:

(Stock Object) Design and implement the stock object. Call the class that captures the various characteristics of a stock object stockType.

The main components of a stock are the stock symbol, stock price, and number of shares. Moreover, we need to output the opening price, closing price, high price, low price, previous price, and the percent gain/loss for the day. These are also all the characteristics of a stock. Therefore, the stock object should store all this information.

Perform the following operations on each stock object:

1. Set the stock information.

2. Print the stock information.

3. Show the different prices.

4. Calculate and print the percent gain/loss.

5. Show the number of shares.

~the natural ordering of the stock list is by stock symbol. Overload the relational operators to compare two stock objects by their symbols.

~ Overload the insertion operator, < ~Because the data is stored in a file, overload the stream extraction operator, >>, for easy input.

For example, suppose infile is ifstream object and the input file was opened using the object infile. Further supppose that myStock is a stock object. Then the statement:

infile >>myStock;

read the data from the input file and stores it in the object myStock. (Note that this statement reads and stores the data in the relevant components of myStock.)

Part B:

Now that you have designed and implemented the class stockType to implement a stock object in a program, it is time to create a list of stock objects.

Let us call the class to implement a list of stock objects stockListType.

The class stockListType must be derived from the class listType, which you designed and implemented in the previous exercise. However, the class stockListType is a very specific class, designed to create a list of stock objects. Therefore, the class stockListType is no longer a template.

Add and/or overwrite the operations of the class listType to implement the necessary operations on a stock list.

The following statement derives the class stockListType from the class listType.

class stockListType:public listType

{

member list

};

The member variables to hold the list elements, the length of the list and the max listSize were declared as protected in the class listType. Therefore, these members can be directly accessed in the class stockListType.

Because the company also requires you to produce the list ordered by the percent gain/loss, you need to sort the stock list by this component. However, you are not to physically sort the list by the component percent gain/loss. Instead, you will provide a logical ordering with respect to this component.

To do so, add a member variable, an array, to hold the indices of the stock list ordered by the component percent gain/loss. Call this array sortIndicesGainLoss. When printing the list ordered by the component percent gain/loss, use the array sortIndicesGainLoss to print the list. The elements of the array sortIndicesGainLoss will tell which component of the stock list to print next.

Part C:

Write a program that uses these two classes to automate the company's analysis of stock data!

Reference no: EM13762602

Questions Cloud

Explain the chain of analysis from payroll : Explain the chain of analysis from payroll to total points and then on to total points and revenue and what other factors might affect these relationships that are outside of the data looked at in this project?
Write the psuedocode showing the logic for a program : Write the psuedocode showing the logic for a program that allows a user to enter 12 numbers and then displays them in the reverse order of their entry
Weather anomalies based problem : Define the weather anomaly
Knowledge of accounting concepts and terminology : Why is a knowledge of accounting concepts and terminology useful to anyone in a business activity? Is there a difference between bookkeeping and accounting? Discuss.
Write a program to help a local stock trading company : Write a program to help a local stock trading company automate its systems. The company invests only in the stock market. At the end of each trading day, the company would like to generate and post the listing of its stocks so that investors can s..
Digital transmission : If you have 20 stations all connected to the same wire and all using digital transmission. What method of sharing the media must be used? Why do you need a sharing method.
Analyze the poems somnambulist ballad and a family turn : Analyze the Poems Somnambulist Ballad and A family turn. This discussion is not an essay, a summary, or abstract.
Explain the differences between management and leadership : Explain the differences between management and leadership, and how cultivating leadership skills in managers can benefit the organization.
Unicorns, geoducks, & whaling related problem : Discuss whether they are headed towards extinction or repopulation of the world's oceans.

Reviews

Write a Review

Programming Languages Questions & Answers

  Design logic for a program contains housekeeping

Design the logic for a program that contains housekeeping,detail loop,and end-of-job modules,and that calculates the service of charge customers owe for writing a bad check.

  Compute the product xy

Given two integers X and Y compute the product XY (multiplication), the quotient X=Y (integer division), and the modulus X (mod Y) (remainder).

  How to create a custom command in unix

How to create a custom command in Unix. Then writing a man page for my command.

  Accepts two int arguments and returns their sum

Assume the availability of a class named Arithmetic that provides a static method , add , that accepts two int arguments and returns their sum .

  Write a perl script code

Write a Perl script which uses the segment of code over and over again, and you are tired of repeatedly typing in this code. Which of the following must you do?

  Enter codes of one to eight characters along

Consider a program to enter codes of one to eight characters along with an associated telephone number and associated notes. A code can represent a person's name, a person's initials, a place, or anything.

  Write recursive function to return maximum element of array

Write down the recursive function which receives three parameters: The recursive function must return maximum element of array.

  Calculate the average of a variable quantity of integers

Create a simple command line program to calculate the average of a variable quantity of integers that are passed as an argument when the program is called.

  Short memo to the vice-president of production

Write a short memo to the vice-president of production recommending whether the availability of any of the three resources (blending, purification, or labor) should be increased from current levels. If you recommend an increase, specify at most ho..

  Create a base class that contains all of the properties

Create a base class (also called a superclass) that contains all of the properties that are common to both of these products. Create 2 derived classes (also called subclasses) that contain different kinds of sizes.

  Program that will help user with metric conversions

Write a program that will help the user with metric conversions. Your program should allow the user to specify the names of the units as strings (e.g., centimeters, liters, grams, for the metric system and inches).

  Compute average of values contained in integer

Compute the average (as a double) of values contained in integer variables num1, num2, num3 and allot that average to double variable avg.

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