473,394 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

urgent help needed with arrays!

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;
}}
Oct 14 '06 #1
1 1577
Banfa
9,065 Expert Mod 8TB
You have attempted to write your interface without implementing any method to store the data. A linked list would work admirably in this case.
Oct 16 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

31
by: da Vinci | last post by:
OK, this has got to be a simple one and yet I cannot find the answer in my textbook. How can I get a simple pause after an output line, that simply waits for any key to be pressed to move on? ...
9
by: garima puri | last post by:
hi ihad made a form in which dynamic rows are added to a table. now when i send there values to next page by GETmethod then in between alphabets where space is given + is shown and where new line...
7
by: meenasamy | last post by:
Hi all, i need to create a function that takes three parameters( Original currency, needed currency, amount) i need to convert from the original currency to the needed currency the amount and...
3
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from...
7
by: kalikoi | last post by:
I have two arrays as follows array1=("45101010","45101010","45103020","45103020","45103020","45201020","45201020", "45201020","45201020","45202010") ...
2
by: Preetam Pattanashetty | last post by:
Hi I am learning ASP.NET using C#. I am able to run .aspx files on local system, but when I load them to the server, I get the "Server Error in '/' Application" error. I have tried to configure the...
4
by: Poornima | last post by:
Hello Let A be an array of n elements.Procedure which takes this array as i/p and produce a matrix which shuold be spiral in nature i.i if A = 7 8 9 10 6 1 2 11 5 ...
1
by: irfi | last post by:
Ok can anyone help me with this problem I have to create a program in NetBeans 4.0 and this is the requirement:- I have to create a base class which consists of EMPLOYEE NAME, CODE and...
0
by: Christopher | last post by:
Urgent Help Needed: The EPVH-1.1 Visual Hull Library. Dear All, I am a student doing research in computer vision. The EPVH-1.1 Visual Hull Library will really help a lot in my research. I...
1
by: programs | last post by:
hi every one, i would like someone to help me write the following program. "Write a C PROGRAM that will determine the first 20 prime numbers and computes their standard deviation. It should show a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.