Solved

Read transactions from multiple files simulatenously

Posted on 2004-04-10
5
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java string replace 11 77
ejb message driven bean mdb creation steps 2 54
Eclipse with various Java releases 7 87
Netbeans and org.apache.commons.lang3 issue 3 53
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
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.
Suggested Courses

734 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