Hi,
Here is what the final output to the screen should look like. Below this is the code I have so far. Can someone please help me as to what i need to do next?? I'm really clueless right now.
Thanks!
Point of Sale Terminal
-----------------
1. Record a Transaction
2. Transaction History
0. Exit Program
Please enter your selection: 2
Transaction History
-------------------
--------------------------------
Total payments: $0
Total refunds: $0
Ending balance: $0
--------------------------------
1. Record a Transaction
2. Transaction History
0. Exit Program
Please enter your selection: 1
Please enter the amount of the transaction
(payments as positive, refunds as negative): 50
Please enter a one-word description: shirt
Transaction recorded for shirt.
1. Record a Transaction
2. Transaction History
0. Exit Program
Please enter your selection: 1
Please enter the amount of the transaction
(payments as positive, refunds as negative): 75
Please enter a one-word description: sweater
Transaction recorded for sweater.
1. Record a Transaction
2. Transaction History
0. Exit Program
Please enter your selection: 1
Please enter the amount of the transaction
(payments as positive, refunds as negative): -35
Please enter a one-word description: belt
Transaction recorded for belt.
1. Record a Transaction
2. Transaction History
0. Exit Program
Please enter your selection: 1
Please enter the amount of the transaction
(payments as positive, refunds as negative): 100
Please enter a one-word description: jacket
Transaction recorded for jacket.
1. Record a Transaction
2. Transaction History
0. Exit Program
Please enter your selection: 1
Please enter the amount of the transaction
(payments as positive, refunds as negative): -45
Please enter a one-word description: shoes
Transaction recorded for shoes.
1. Record a Transaction
2. Transaction History
0. Exit Program
Please enter your selection: 2
Transaction History
-------------------
1. Payment: $50 - shirt
2. Payment: $75 - sweater
3. Refund: $35 - belt
4. Payment: $100 - jacket
5. Refund: $45 - shoes
--------------------------------
Total payments: $225
Total refunds: $80
Ending balance: $145
--------------------------------
1. Record a Transaction
2. Transaction History
0. Exit Program
Please enter your selection: 0
Closing Account...
*** End of Program ***
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int display_menu ();
int transact ();
int transaction_history ();
void main ()
{
int menu_choice = 0,
running_total,
history,
sales=1,
refunds=1,
current_total=1;
char clothes [15];
const int ARRAYSIZE = 25;
int transaction [ARRAYSIZE] = {0};
int total = 0;
for (int i = 0; i < ARRAYSIZE; i++ )
total += transaction[i];
cout << "Point of Sale Terminal\n"
<< "----------------------\n";
while ( menu_choice = display_menu() )
{
switch ( menu_choice ) {
case 0:
break;
case 1:
running_total = transact ();
cout << "Please enter a one-word description: ";
cin >> clothes;
cout << "Transaction recorded for " << clothes << ".\n";
break;
case 2:
cout << "The total is " << total << ".\n";
break;
}
}
cout << "\n\n*** End of Program ***\n\n";
}
int display_menu ()
{
int selection;
cout << "\n1. Record a Transaction"
<< "\n2. Transaction History\n"
<< "\n0. Exit Program"
<< "\n\nPlease enter your selection: " ;
cin >> selection;
return selection;
}
int transact ()
{
int current_total=1;
int running_total=1;
int sales;
int refunds;
{
cout << "\nPlease enter the amount of the transaction\n"
<< "(payments as positive, refunds as negative): ";
cin >> current_total;
while ( current_total ==0)
{ cout << " Transaction was not recorded.\n";
}
return current_total;
}}
int transaction_history ()
{
int running_total=1;
int sales;
int refunds=5;
{
cout << "Transaction History\n"
<< "-------------------\n";
return refunds;
}}