NEED MAJOR HELP WITH THIS ASSIGNMENT

You work for a stock brokerage firm and your manager would like your help in determining how much money is spent in commissions for all the brokers. Prepare a stock report to help track the commissions.


INPUT

The input should contain the name of the broker, the amount of the transaction, an indicator that the transaction was a purchase or sale (“P” or “S” in the Transaction Type field), and an indicator of the exchange where the transaction took place (“N” = New York Exchange; “A” = American Stock Exchange; “O” = Over the Counter).




PROCESSING


The transaction type should be edited to insure the user enters either an “S” or “P” and appropriate error messages should be developed for incorrect responses.

The exchange should be edited to insure the user enters either an “N” , “A” or “O” and appropriate error messages should be developed for incorrect responses.

The commission amount is calculated as follows: If the transaction was a Purchase on the New York Stock Exchange (NYSE), the commission is 4.5% (.045) of the transaction amount. If the purchase was on the American Stock Exchange (AMSE), the commission is 3.5% (.035) of the transaction amount. Otherwise, the commission is 3% (.03) of the transaction price. If the transaction was a Sale on the New York Stock Exchange (NYSE), the commission is 2.5% (.025) of the transaction price; otherwise, the commission is 2% (.02) of the transaction price.


OUTPUT



A sample of what should be displayed for output is shown below:


Jim has earned $XX.XX in commissions on XXXX.XX transactions.

Would you like to enter another salesman?



When the user indicates there are no more entries the program should display the following:


Total salesmen processed X
Total transactions for all salesmen XX
Total commission for all salesmen $XXXX.XX

The program’s code should be structured and well commented. The program should validate all data entered using functions. (Only S and P allowed for transaction type, only N, A ,or O for the type of stock exchanged used, and only positive numbers entered for transaction amounts) Round all output to two decimal places

Last edited on
this is what I have as of right now. I have all my error messages working now I just need to put that in a loop so it keeps asking them until they input the correct answer but im a little confused on how to do so. After that I still need to put in all the math that's involved with the end result. ANY SUGGESTIONS?!?!



#include <iostream>
#include <string>
using namespace std;

//declaring funcitons
double NewYork(double commision1);
double AmericanStock(double commission2);
double OverCounter(double Commision3);
bool TypeOfTrans(char Trans);
bool LocationOfTrans ( char Loc);

int main()
{
//setting my variables
string Name;
double Amount;
char TransactionType, PlaceOfExchange;
bool CheckType, CheckLoc;



//ask for name
cout << " Enter Brokers Name " << endl << endl;
cin >> Name;


//ask for thre amount of transaction
cout << " What Was the Amount of Your Transaction " << endl << endl;
cin >> Amount;



cout << " Type 'P' for Purchase or 'S' for Sale " <<endl << endl;
cin >> TransactionType;

CheckType = TypeOfTrans(TransactionType);

if (CheckType == false)
{
cout << " Invalid Entry, Please Enter a 'P' or a 'S'. " <<endl <<endl;
}

else
{


cout << " Where Did This Transaction Take Place, Type 'N' for New York Exchange, 'A' for American Stock Exchange, or 'O' for Over the Counter " << endl <<endl;
cin >> PlaceOfExchange;

CheckLoc = LocationOfTrans(PlaceOfExchange);

if (CheckLoc == false)
{
cout << " Invalid Entry, Please Enter A 'N' for New York Exchange, 'A' for American Stock Exchange, or 'O' for Over the Counter " <<endl << endl;
}
}








system("pause");
return 0 ;
}

bool TypeOfTrans (char Trans)
{

if(Trans == 'S' || Trans == 'P')
{
return true;
}

else
return false;

}



bool LocationOfTrans (char Loc)
{

if(Loc == 'N' || Loc == 'A' || Loc == 'O')
{
return true;
}

else
return false;
}

//double NewYork(double commision1)
//{
//
//
//
//}
//
//double AmericanStock(double commission2)
//{
//
//
//}
//
//double OverCounter(double Commision3)
//{
//
//
//}
I have all my error messages working now I just need to put that in a loop so it keeps asking them until they input the correct answer


Something like...
1
2
3
4
5
6
	while (x != 'P' && x != 'S')
	{
		std::cout << "\nYour input " << x << " is incorrect.\n";
		std::cout << "Is the transaction a purchase (P) or sale (S) P/S? >>>";
		std::cin >> x;
	}
Topic archived. No new replies allowed.