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_his tory ();
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 << "Transactio n 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_his tory ()
{
int running_total=1 ;
int sales;
int refunds=5;
{
cout << "Transactio n History\n"
<< "-------------------\n";
return refunds;
}}
1 1597 Banfa 9,065
Recognized Expert Moderator Expert
You have attempted to write your interface without implementing any method to store the data. A linked list would work admirably in this case.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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?
Basically: "Press any key to continue..."
I beleive that I am looking for is something along the lines of a....
|
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 is there &
is shown.
can anyone tell me how to solve this or get data in a proper way.
thanks
*** Sent via Developersdex http://www.developersdex.com ***
|
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 return the new
amount in the needed currency, I need this function to work real time
(obtaining real time currency exchange rates), any ideas???
|
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 the socket is missing the
last character (line feed). When the same text is sent without the urgent
flag set, all of the characters are read.
I'm reading the data using the blocking read call of the network stream
class. The .NET...
|
by: kalikoi |
last post by:
I have two arrays as follows
array1=("45101010","45101010","45103020","45103020","45103020","45201020","45201020",
"45201020","45201020","45202010")
array2=("0.44","0.1","0.13","2.61","0.15","0.42","0.12","0.63","0.12","0.23")
The final output should be as follows
| |
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 web.config file but has not been fruitful.
I would be thankful if the following questions were answered:
a)has the write permissions on files and folders have to do something with it?
b)what role does asp_client folder play?
c) What other...
|
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 4 3 12
|
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 DESIGNATION. The derived class contains the data members YEARS OF EXPERIENCE and AGE. The values have to be stored in the array.
FOLLOWING ACTION HAS TO BE DONE WHEN PROGRAM RUNS.
1. User can view the values stored in the arrays
2. User can enter a new entry...
|
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 did have this library before but I didn't keep my copy of this
library because I always thought I could download it again form
internet. However, the author of this library closed the download
|
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 proper use of program flow controls, arrays and functions."
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |