For this activity we will use the same account class we have used in the past. This
Fantastic news! We've Found the answer you've been seeking!
Question:
For this activity we will use the same account class we have used in the past. This time we will not used inheritance or any other menu driven options.
Use the program written at:
http://www.cs.sjsu.edu/~pearce/modules/lectures/j2se/multithreading/synch1.htm
What to do:
- The BankAccount program remains the same.
- Use the Producer and Consumer threads. Change them to take input from the user and use that amount for deposit or withdraw. - 10 marks
- Now change the Bank class to:
- Initialize four threads - as given
- Test them with thread start(). Show the result with 4 inputs. - 5 marks
- Now increase the priority of deposit thread and see the difference. - 5 marks
- No increase the priority of withdraw thread and show the difference. - 5 marks
- To see the difference, check with the same amounts in both the inputs
- Now create a new thread as consumer and join it into the system (before printing the final balance) - 5 marks
- Demonstrate its role.
To submit:
- Copy all the files in the word document.
- Show the screen shots under each question.
- Explain the output
- short note on your learning of this new concept.
Related Book For
Posted Date: