Solved

Read transactions from multiple files simulatenously

Posted on 2004-04-10
5
230 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

867 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

21 Experts available now in Live!

Get 1:1 Help Now