Solved

Read transactions from multiple files simulatenously

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

773 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