Solved

Read transactions from multiple files simulatenously

Posted on 2004-04-10
5
217 Views
Last Modified: 2012-05-04
write a Java program that manages a simple checking account.
There are 2 simple transactions: deposit and withdrawal. Both transactions come from a simple text file with the following columns: customer_last_name, branch, branch_account_number, transaction, amount. For example:

Silver            1000      001      withdrawal      20
Smith            1001      001      withdrawal      40
Black            1000      002      deposit            20
Bush            1003      005      deposit            100
Silver            1000      001      withdrawal      40

Note that branch_account_number is only unique within a branch!

Your program should be able to read transactions from multiple files simultaneously (think how you are going to protect the integrity of your data). The program should execute the transactions, maintaining the right balances. You may hardcode the number of input files (where transactions are stored). You do not have to remember the exact syntax of file operations, etc. Make reasonable assumptions. Remember that file i/o may fail, you have to handle exceptions gracefully.
0
Comment
Question by:m_nekkanti
  • 2
5 Comments
 
LVL 24

Accepted Solution

by:
sciuriware earned 500 total points
ID: 10797600
As you may know on EE we are not allowed to do your homework.
All I can say is: try a construct with a thread per file that reads a file as it grows.
If you want an alternative, you will end in multiple external programs that send data to a pipe read in the JAVA program.
It depends on the O.S. what can be done.

But please do not expect a complete written solution here!

You may post some code that you already have to have it scrutinized by us.

;JOOP!
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10804187
In order to maintain your transactions,

Keep all your data buffered until all the operations are completed.  Persist the data when the transaction is successful.

RandomAccessFile would help you in updating/reading a file.


Regards,
Muruga
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10804209
If there is a IO Failure, the contents won't persist in the file.   You can rollback the transaction by doing nothing.

0
 

Author Comment

by:m_nekkanti
ID: 10822609
I aked for help, the direction how I can proceed. Because I dont have experience in multithrading, deadlocks.
How can I remove this question from this forum?
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now