//Diego Martinez CSC5 Chapter 2, P.84, #17
/*******************************************************************************
* Verifying Stock Commission
* ______________________________________________________________________________
* This program calculates the total amount Kathryn paid for her stock including
* the commision she has to pay to her stock broker.
*
* Computation is based on the Formula:
* Stock Amount = Shares * Price per Share
* Commission = Stock Amount * Commission Rate
* Total Amount = Stock Amount + Commission
*_______________________________________________________________________________
* INPUT
* shares : Total Number of shares
* pricePerShare : Cost of each share
* commissionRate : Broker commission rate
*
* OUTPUT
* stockAmount : Amount paid for the stock alone
* commission : Amount of the strock brocker's commission
* totalAmount : Total amount paid including commission
*******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
//Given Values
int shares = 600;
double pricePerShare = 21.77;
double commissionRate = 0.02;
//Calculations
double stockAmount = shares * pricePerShare;
double commission = stockAmount * commissionRate;
double totalAmount = stockAmount + commission;
//Output
cout << "Amount paid for the stock alone: $" << stockAmount << endl;
cout << "Amount of the commisson: $" << commission << endl;
cout << "Total amount paid (stock + commission): $" << totalAmount <<endl;
return 0;
}