#include using namespace std; /* int NumShares = 0; double SalePrice = 0; double PurchasePrice = 0; double SaleCom = 0; double PurchaseCom = 0; double TradeProfit = 0; double OverallProfit = 0; */ // Variables for the function calls int Get_NumShares(); double Get_SalePrice(); double Get_SaleCom(); double Get_PurchasePrice(); double Get_PurchaseCom(); int main() { // Variavles defined int NumShares = 0; double SalePrice = 0; double PurchasePrice = 0; double SaleCom = 0; double PurchaseCom = 0; double TradeProfit = 0; double OverallProfit = 0; char Again = 'n'; do { // do loop so the user can run it as many times as s/he wants NumShares = Get_NumShares(); SalePrice = Get_SalePrice(); PurchasePrice = Get_PurchasePrice(); SaleCom = Get_SaleCom(); PurchaseCom = Get_PurchaseCom(); TradeProfit = ((NumShares * SalePrice) - SaleCom) - ((NumShares * PurchasePrice) + PurchaseCom); OverallProfit += TradeProfit; cout << "Do you want to try again? (y/n) "; cin >> Again; cout << "Your Number of shares entered is: " << NumShares << endl; cout << "Your Purchase Price entered is: " << PurchasePrice << endl; cout << "Your Purchase Commissions entered is: " << PurchaseCom << endl; cout << "Your Sales Commissions entered is: " << SaleCom << endl; cout << "Your Sales Price entered is: " << SalePrice << endl; cout << "Your total from this trade is: " << TradeProfit << endl; } while((Again == 'y') || (Again = 'Y')); // outputs so the user knows everything they have entered // and the outcomes of their dumb trades // buy google stock and microsoft!! FTW cout << "Your cumulative total of trades is: " << OverallProfit << endl; } int Get_NumShares() { int NumShares; do { cout << "What is the number shares? "; cin >> NumShares; if (NumShares < 0) cout << "Sale price must be > 0. "; } while (NumShares == 0); return NumShares; }; double Get_SalePrice() { double SalePrice; do { cout << "What is the sale price? "; cin >> SalePrice; if (SalePrice < 0) cout << "Sale price must be > 0. "; } while (SalePrice == 0); return SalePrice; }; double Get_SaleCom() { double SaleCom; do { cout << "What is the sales commission? "; cin >> SaleCom; if (SaleCom <= 0) cout << "Sale commission mus be >= 0. "; } while (SaleCom == 0); return SaleCom; }; double Get_PurchasePrice() { double PurchasePrice; do { cout << "What is the purchase price? "; cin >> PurchasePrice; if (PurchasePrice < 0) cout << "Purcahse Price muse be > 0. "; } while (PurchasePrice == 0); return PurchasePrice; }; double Get_PurchaseCom() { double PurchaseCom; do { cout << "What is the purchase commission? "; cin >> PurchaseCom; if (PurchaseCom <= 0) cout << "Purcahse commission muse be > 0. "; } while (PurchaseCom == 0); return PurchaseCom; };