[Solved] JAC444 Workshop 10-URLs, Sockets, and Client-Server Networking in Java

$25

File Name: JAC444_Workshop_10-URLs,_Sockets,_and_Client-Server_Networking_in_Java.zip
File Size: 659.4 KB

SKU: [Solved] JAC444 Workshop 10-URLs, Sockets, and Client-Server Networking in Java Category: Tag:
5/5 - (1 vote)

This assignment lets you practice Multi-Threaded programming in Java and includes concepts such as Threads, Guarded Blocks, and Synchronization.

Give a solution to the following problem:

You want to help your friend with some money. You and your friend have access to a shared account, but in a Strange Bank.

The Strange Bank has the following rule for the accounts: once you deposit some money in some currency (to an account with an initial balance of zero,) you are not allowed to deposit money in another currency, unless the account balance would be zero (again.)

You have one Dollar, two Euros, and three Pounds and you want to transfer these amounts to your friend. Write a Java program that simulates you depositing to and your friend withdrawing from the shared account.

Hints: You and your friends are Java Threads that try to access the bank account concurrently (you to deposit, your friend to withdraw). You must communicate through wait and notify methods.

Make sure that all the deposit and withdraw actions between you and your friend should happen to be in amounts of one (at a time).

This is a classical problem in thread theory called Producer/Consumer in which there is a container that accepts only one object at a time. Producer wants to put in the container as many objects as it produces but must wait until the consumer consumes the already-shared object from the container.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] JAC444 Workshop 10-URLs, Sockets, and Client-Server Networking in Java
$25