home / study / engineering / computer science / computer science questions and answers / write…

home / study / engineering / computer science / computer science questions and answers / write a class (with driver of course) stockmarketindices that contains a vector of dynamically … Your question has been answered Let us know if you got a helpful answer. Rate this answer Question: Write a class (with driver of course) StockmarketIndices that contains a vector of dynamically cr… Write a class (with driver of course) Stockmarket Indices that contains a vector of dynamically created elements. Each element contains a company name, stock market index , stock buying and selling price in US$ location of company and category (eg. farming, computing, etc). Create a text file called stocks.text and input 10 lines. Each line contains the above information. For example each line would look like: MICROSOFT MSFT 234.56 223.65 WA COMPUTER Your class should have one constructor that reads the information from this file, creates the vector of size 10 and then closes the file. Other functions are: Display: toStringtype method that displays the list of stocks (position, company name,index, buying selling price,location and category). It should display for example 1. NOKIA NOK 44.56 45.78 CA COMPUTER 2. WALMART. WMT 99.45 98.32 AR RETAIL Note: Position refers to the vector index +1. Overload the Display method with one parameter (string index) that displays the position and buying/selling price for that particular company index. Overload Display method again with one parameter(int position, bool buy) that displays the stock price at that position. if buy is true display the buying price. Else display the selling price.