3.4k views
2 votes
(Stock Market) 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:

(A) symbol opening
(B) Price closing
(C) Price today
(D) High today
(E) Low prev
(F) Close volume

User Mrkschan
by
7.9k points

1 Answer

4 votes

Answer:

Check attached file

Step-by-step explanation:

#include

#include

#include

#include

using namespace std;

class stockType

public:

stockType();

stockType(string stockSymbol,double OPrice,double CPrice,double THPrice,double TLPrice,double YCPrice,int shares);

void setStockSysmbol(string stockSymbol);

void setOPrice(double OPrice);

void setCPrice(double CPrice);

void setTHPrice(double THPrice);

void setTLPrice(double TLPrice);

void setYCPrice(double YCPrice);

void setShares(int shares);

string getStockSysmbol();

double getOPrice();

double getCPrice();

double getTHPrice();

double getTLPrice();

double getYCPrice();

int getShares();

friend istream& operator>> (istream& is, stockType& a);

friend ostream& operator< (ostream&="" os,="" const="" stocktype&="">

bool operator ==(stockType s)

if(stockSymbol.compare(s.getStockSysmbol())==0)

return true;

else

return false;

User Epsilonhalbe
by
7.6k points