By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,554 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,554 IT Pros & Developers. It's quick & easy.

client-server application

P: 1
i am new to the JAVA...Any one help to make codes for this server client application program
"Design and implement a server application which acts as an Internet bank, i.e. keeps track of bank accounts and allows clients to connect over the Internet and make deposits and withdrawals from any of the bank accounts. Also implement the client application. Use any port number available for general use, i.e. in the range 50000 through 65535"
Functional specification of the client and server
1. Upon launch, the client should prompt the user for the hostname of the computer runningthe server.
2. The client should then ask the user for account number and amount of money to be deposited or withdrawn from the account. A negative amount corresponds to a withdrawal and a positive to a deposit.
3. When receiving a request, the server should check if the transaction can be made. There are two requirements:
(a) The account number must be valid.
(b) For withdrawals, the account balance prior to the transaction must be equal to or larger than the amount withdrawn to prevent a negative balance.
(c) To prevent fraud, an account may not be updated more frequently than once
every 60 seconds.
The client should inform the user with a message whether the transaction was successful or not and, if it was, print the current account balance after the transaction. An invalid account number should result in a message that the transaction was unsuccessful, and should not cause an exception at the server.
4. For debugging purposes, the server should print nicely the status of all ten accounts on screen after each transaction.
5. Finally, the client should ask the user if she wants to make another transaction or not. If not, a signal should be sent to the server to terminate the connection and the client should exit.
other information.
2. The applications should communicate through TCP.
3. The server must be able to handle several clients simultaneously. In Java, this is easiest done by making the server multithreaded.
Jan 28 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 1,510
break the problem down into a number of steps
(1) implement and test a class to hold a single account and do transactions on it, e.g. create and account, make a deposit, print an accout, etc - both the client and server will need this
(2) implement a class to hold a number of bank accounts and process them, e.g. in an ArrayList? the server will nee this.
(3) implement the client/server initially with a single thread -
(3) then multithread the server to deal with multiple clients

the following discess TCP/IP clients and server mainly from a C point of view but also with java examples
http://sage.mc.yu.edu/kbeen/teaching/networking/resources/sockets.html
Jan 28 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.