Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE GIVE SOURCE CODE IN JAVA ONLY!!!!! Problem specification: In a client-server system, the client application sends requests to a server application through a network

image text in transcribed

image text in transcribed

image text in transcribed

PLEASE GIVE SOURCE CODE IN JAVA ONLY!!!!!

Problem specification: In a client-server system, the client application sends requests to a server application through a network connection. In such system, the user interface is implemented in the client and the database is stored in the server. You are required to implement a client-server application to process banking transactions such as withdrawals and deposits. In modern banking systems, a costumer accesses a bank account using an access card at an ATM, at the counter or on the web. Implementation: The following diagram illustrates the classes for the client-server banking - Network class: The Network class provides the infrastructure to allow the client and the server to process the transactions. The client and the server need to be connected (using connect()) to the network prior to an exchange. The Network class also implements an input buffer (inComingPacket[]) and an output buffer (outGoingPacket[]) to respectively receive transactions from the client and to return updated transactions to the client. The capacity of these buffers are 10 elements, so the network indicates whether they are full or empty. - Client class: The Client class reads all the transactions from a file (transaction.txt) and saves them in an array (transaction[]). A transaction is implemented by the Transactions.class. Using the send() method of Network class the client transfers the transactions to the network input buffer and it yields the cpu in case the network input buffer is full. Also, using the receive() method of Network class the client retrieves the updated transactions from the network output buffer and yields the cpu in case the buffer is empty. Each updated transaction received is displayed immediately on the screen. - Server class: The Server class reads all the accounts from a file (account.txt) and saves them in an array (account[]). An account is implemented by the Accounts class. Using the transferrIn() method of Network class the server retrieves the transactions from the network input buffer and performs the operations (withdraw, deposit, query) on the specific accounts. It yields the cpu in case the buffer is empty. Each updated transaction is transmitted to the network output buffer using the transferOut ( ) method of Network class and the server yields the cpu in case the buffer is full. - Problems: - You need to complete the Java program that is provided by implementing 4 threads so that the client, the server and the network all run concurrently. The client has 2 threads, one for sending the transactions and another for receiving the completed transactions. In case the input and output network buffers are full or empty each client or server thread must yield the cpu using the Java method Thread.yield(). The network thread executes an infinite loop that ends when both client and server threads have disconnected. In case the client or sever threads are still connected the network thread must continuously yield the cpu. Evaluation: You will be evaluated mostly on the implementation of the required methods, the implementation of the threads, the measurements of the running times and the voluntary sharing of the cpu by the threads. - Evaluation criteria

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions