# CIS 1111

CIS 1111 Programming Topic 5 – Stockmarket Portfolio Tracker
Description:
In this assignment, you will develop a C++ program that calculates gain or loss of a stock you purchased.  Go to the website “Yahoo! Finance” and select a technology stock for your assignment. Some examples of technology stocks include Apple, Cisco, IBM, Teradata, etc….
In your program, the user will enter the following pieces of information:
the name of the stock
the stock symbol
the number of shares purchased
the purchase price
the commission paid
Have the user enter the company name and stock symbol
Have the user enter the number of shares purchased
Have the user enter the price per share, sharePrice.
Calculate the sharesCost which is the number of shares * price per share
When you purchase stock you need to pay a commission based on the number of shares purchased times the purchase price. Multiply the commission rate times shareCost.
Add the sharesCost to the commission to calculate total cost of purchase
After holding the stock for a period of time you may want to sell. Use a random number generator to simulate a percentage change in your sale price. The generator will generate a number between 1 and 100 but since you want a percentage, divide the number generated by 100. See pages 127-129 for how to create a random number and do not forget to seed the random number generator.
To determine if the change in the stock value is positive or negative (the stock market can go down or up), toss a coin to generate a random outcome (gain or loss). Below is the code for flipping a coin.
Multiply percentage from step 7 by the profitLoss which will make the percentage positive or negative.
Multiple percentage from step 9 by the sharePrice and add it back to the sharePrice. Your formula will look like this NewSharePrice = (percentGain * sharePrice) + sharePrice. percentGain was calculated in step 9.
Calculate the new value of your shares multiple the newSharePrice times the number of shares.
Now you are going to sell your shares.  When you sell stock you need to pay commission to your broker.  The commission on the sale needs to be recalculated (commission times the new value of your stock). The profit (or loss) you make will be what you paid for the stock (including the commission) minus what you netted from the sale (the new value of your shares minus the commission).
Did you make money or lose money on your stock purchase? Calculate your gain or loss.
Your rate of return is your profit divided by the original cost. This percentage could be negative (if your stock decreased in value) or positive (if your stock increased in value).
Be sure to…
Use variables of the appropriate data type to store inputs, subtotals and totals, and outputs.
Variable names must be descriptive
Use cout to output the values to the console. Your cout statement must use the variables to display the values.
Use the random number generator to generate the gain and whether it is a loss or a gain.
Output must be labeled and easy to read as shown in the sample output below.
Program must be documented with the following:
// Name
// Date
// Program Name
// Description