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 investors can see how their holdings performed that day. Assume the company invests in 10 different stocks. The desierd 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 3782

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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 investors can see how their holdings performed that day. Assume the company invests in 10 different stocks. The desierd 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

Add and/or overwrite the operations of the class listType to imple-
stock objects. Therefore, the class stockListType is no longer a template.
implement a stock object in a program, it is time to create a list of stock
The class stockListType must be derived from the class listType,
Let us call the class to implement a list of stock objects stockListType.
Now that you have designed and implemented the class stockType to
(Note that this statement reads and stores the data in the relevant com-
reads the data from the input file and stores it in the object mystock.
was opened using the object infile. Further suppose that wystock
For example, suppose infile is an itstream object and the input file
The following statement derives the class stockListType from the
the class stockListType is a very specific class, designed to create a list of
Programming Exeroses 989
infile >> mystock;
ponents of mystock.)
a
objects.
a
The designed and implemented in the previous exercise. However
ment the necessary operations on a stock list
class listType.
lass stockListType: public listType<stockType>
{
member list
};
The member variables to hold the list elements, the length of the list, and
the maximum size of the list 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, yeu 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.
lo 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 compo-
nent percent gain/loss, use the array sortIndicesGainLoss to print
ite a program that uses these two classes to automate the company's
analysis of stock data.
component of the stock list to print next.
Transcribed Image Text:Add and/or overwrite the operations of the class listType to imple- stock objects. Therefore, the class stockListType is no longer a template. implement a stock object in a program, it is time to create a list of stock The class stockListType must be derived from the class listType, Let us call the class to implement a list of stock objects stockListType. Now that you have designed and implemented the class stockType to (Note that this statement reads and stores the data in the relevant com- reads the data from the input file and stores it in the object mystock. was opened using the object infile. Further suppose that wystock For example, suppose infile is an itstream object and the input file The following statement derives the class stockListType from the the class stockListType is a very specific class, designed to create a list of Programming Exeroses 989 infile >> mystock; ponents of mystock.) a objects. a The designed and implemented in the previous exercise. However ment the necessary operations on a stock list class listType. lass stockListType: public listType<stockType> { member list }; The member variables to hold the list elements, the length of the list, and the maximum size of the list 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, yeu 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. lo 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 compo- nent percent gain/loss, use the array sortIndicesGainLoss to print ite a program that uses these two classes to automate the company's analysis of stock data. component of the stock list to print next.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 9 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education