I'm not sure if my title makes sense, but I have an assignment and need some guidance on how to approach this.

It's an Accounts Receivable program for ABC Hardware Company. I have a Master file with cust numbers, cust name and balance due. I also have a Transaction file with cust number, transaction type(Payment or Order), item ordered, quantity and total amount. If the transaction is a Payment I subtract from the customer balance due. If its an order I add it. There should be more than one transaction record for each master record.

I am having a tough time figuring out how to first approach this without confusing myself. I have a structure and created the two files but I'm not sure in which order I should do things. I appreciate any advice you can give that will put me in the right direction.

Thank you in advance.

My output should have:

[B]Customer Name    Customer Number
                 Previous Balance $


Transaction#  Item Ordered  Order Amount $
Transaction#  Payment       Payment Amount $

                            Balance Due $
[/B]

Recommended Answers

All 2 Replies

I am having a tough time figuring out how to first approach this without confusing myself.

1. create an ifstream object
2. open your master file.
3. check for errors.
4. load ye' master file into a vector< > of structs.
5. close the ifstream object

6. create another ifstream object.
7. open your transaction file.
8. check for errors.
9. load ye' transaction file into a deque< > of structs.
10. close the ifstream object.

11. perform ye' calculations via comparison of the master file array and the transaction array. edit the transaction array as necessary.

12. create an ofstream object
13. open the transaction file (using the ios::trunc flag to over-write existing text)
14. write the newly edited contents of the transaction deque< > to the transaction file.
15. close the ofstream object.

ye' are done.

I will offer code for any 3 of the above given steps of your choice, free of charge. Choose wisely.

Thank you very much. This is a great outline! I will get working. I built two structures so I think I'm half way there.

I will definitely take you up on the free code for 3 of those steps, not sure which ones just yet.

Thanks again!

commented: teehee +10
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.