This lab "upgrades" the information in lab 1. First the name of each company is listed as a string that starts each entry in the file and it's cost per share is also included as a double as the last item listed for each stock. Revise the class Stock to hold the extra information and reconstruct read to read the name first and the cost per share last. Revise the Stock print function to print the name after the id number and the cost per share followed by the total value (number of shares times cost per share) at the end of the line. Separate each item by tabs and make sure the output of dollars and cents is in the $####.## format. Finally create a member function of Stock that will print a summary to a stream (file) that is provided as a parameter. For each stock print the name of the company and the total value of the stock.
To get a copy of the data for lab 2 click here .