Develop a C++ program
Develop a C++ program and a Raptor flowchart for a program that calculates gain or loss of a stock you purchased. Go to the website Yahoo! Finance and select a technology stock. For example Cisco, IBM, Teradata. Enter the name of the stock, the stock symbol, the number of shares purchased, the purchase price and the commission paid.
1. Have the user enter the company name and stock symbol
2. Have the user enter the number of shares purchased
3. Have the user enter the price per share
4. Calculate the sharesCost which is the number of shares * price per share
5. When you purchase stock you need to pay a commission based on the sharesCost
6. Add the sharesCost to the commission to calculate total cost of purchase
7. In order to simulate what the value of the stock is now, use a random number generator. The generator will generate a number between 1 and 100 but since you want a percentage, divide the number generated by 100.
8. To determine if the gain is positive or negative (the stock market can go down or up). Toss a coin. Below is the code for flipping a coin.
9. Multiply percentage from step 7 by the profitLoss.
10. Multiple percentage from step 9 by the share price and add it back to the sale price. Your formula will look like this NewSharePrice = (percentGain * originalSalePrice) + originalSalePrice
11. Calculate the new value of your shares multiple the newSharePrice times the number of shares.
12. Did you make money? Calculate your gain or loss.
13. Your rate of return is your profit divided by the original cost.