I have been working on this program for my class and I have everything working fine it seems up until I get my New Balance output. What I get for the output is below.

Date Account Type Amount New Balance
06/19 9858-5420-3025-7452 P 5500.00 -2694.35
06/19 1111-1111-1111-1111 C 430.00 -2264.35
06/20 7307-8304-0929-4295 C 36.45 -2227.90
06/20 1132-2648-4476-0945 P 130.00 -2357.90
06/20 5540-8530-4034-5532 C 275.23 -2082.67
06/20 7307-8304-0929-4295 P 250.00 -2332.67

This is what my output is suppose to look like.

Transaction Report

Date Account Type Amount New Balance

06/19 9858-5420-3025-7452 P 5500.00 5843.82
06/19 1111-1111-1111-1111 C 430.00 *** Invalid account number ***
06/20 7307-8304-0929-4295 C 36.45 243.90
06/20 1132-2648-4476-0945 P 130.00 2675.65
06/20 5540-8530-4034-5532 C 275.23 *** Credit limit exceeded ***
06/20 7307-8304-0929-4295 P 250.00 6.10CR

I went ahead and attached the header and .cpp files to this post, the only thing I can't give you is the input files which I know makes it hard to help but they are on our unix accounts and there is no other way for me to get it.

Here are the links to my assignment as well:
http://www.cs.niu.edu/~mcmahon/cs241/Assign/as2241m09.html
http://www.cs.niu.edu/~mcmahon/cs241/Assign/output2.txt

Any help on this would be greatly appreciated, thanks for your time in advance.

Recommended Answers

All 9 Replies

Can you extract the problem into ~ 20 lines? Maybe make a hard coded name/date/account and then just call the function that is returning the wrong value?

assign.cpp calls read_accounts() twice -- why???

line 87: >> strcmp(accountList.get_accountNumber(),tranAcct)==0;


that should be an if statement -- without the if the loop will not work correctly. if( strcmp(accountList[i].get_accountNumber(),tranAcct)==0)

I called the function then called it again to store the number it was returning. I still been playing with the code and I don't see where my error is causing the incorrect output though. hm

That's just plain silly and grossly inefficient:icon_eek: ! -- the return value will the the same every time you call that function, so just call it once and save the return value then.

Alright I will do that do you have any suggestions as to why my output for new balance is so far off? I know its a pain with everything being in different files and I can't download the input files which complicates things even further. Any input for that issue would be great, thanks.

You mean the files are on the unix accounts at school and they won't give you a copy so that you can work with the files at home?

the permissions are set so they can only be put in our folder on unix and not downloaded onto our computers so we can use them with dev or something of the sort

Bummer! There's not much I can do for you without that file, or something similar.

Thats what I feared, thanks anyways.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.