UMGC 335 CMSC 335 Questions

Homework 31. (5 pts) What events do the following components generate in either Swing or FX:



JButton or Button
JTextField or TextField
JComboBox or ComboBox
2. (5 pts) What methods does JTable implement which are required by the interfaces implemented by
the JTable class beyond those interfaces implemented by the various parent classes of JTable?
3. (5 pts) Address how the differences among these various layout managers, focusing on their behavior
as their container is resized:
a.
b.
c.
d.
e.
FlowPane in FX (or FlowLayout in Swing)
GridPane in FX (or GridLayout in Swing)
AncherPane
TilePane
Any other layout of your choice in FX or Swing.
4. (10 pts) (Ex 1.8.2) The dining philosophers problem was invented by E. W. Dijkstra, a concurrency
pioneer, to clarify the notions of deadlock and starvation freedom. Imagine five philosophers who spend
their lives just thinking and feasting. They sit around a circular table with five chairs. The table has a big
plate of rice. However, there are only five chopsticks (in the original formulation forks) available, as
shown in Fig. 1.5. Each philosopher thinks. When he gets hungry, he sits down and picks up the two
chopsticks that are closest to him. If a philosopher can pick up both chopsticks, he can eat for a while.
After a philosopher finishes eating, he puts down the chopsticks and again starts to think.
a. What is wrong with everybody doing the following – other than that the philosophers never get up
from the table?
1
1.
2.
3.
4.
5.
6.
7.
think for a while
get left chopstick
get right chopstick
eat for a while
return left chopstick
return right chopstick
return to 1
b. How can the above be fixed to avoid deadlocks?
c. Is your solution starvation free? Literally!
5. (10 pts) What methods must a class implementing the java.util.concurrent.locks.Lock interface
implement? Describe some of the expected characteristics of each of the methods of this interface?
6. (5 pts) Explain what the JVM does when it encounters a synchronized directive. Hint: consider
carefully what is synchronized.
7. (10 pts) What is the difference between Lock Interface and synchronized keyword?
Grading Rubric:
Attribute
Problem 1
Problem 2
Meets
Does not meet
5 points
Lists the events associated with each
provided component.
5 points
Lists the methods JTable implements.
0 points
Does not list the events associated with
each provided component.
0 points
Does not list the methods JTable
implements.
Lists the methods which are required
by the interfaces implemented by the
JTable class beyond those interfaces
implemented by the various parent
classes of JTable.
Problem 3
Problem 4
5 points
Addresses the differences among the
various layout managers.
Focuses on their behavior as their
container is resized.
10 points
Explains what is wrong with
Does not list the methods which are
required by the interfaces implemented
by the JTable class beyond those
interfaces implemented by the various
parent classes of JTable.
0 points
Does not address the differences among
the various layout managers.
Does not focus on their behavior as their
container is resized.
0 points
Does not explain what is wrong with
everybody doing the actions provided.
2
Problem 5
Problem 6
Problem 7
everybody doing the actions
provided.
Does not explain how the actions be fixed
to avoid deadlocks.
Explains how the actions be fixed to
avoid deadlocks.
Does not explain if the solution provided is
starvation free.
Explains if the solution provided is
starvation free.
10 points
Explains what methods a class
implementing the
java.util.concurrent.locks.Lock
interface must implement.
0 points
Does not explain what methods a class
implementing the
java.util.concurrent.locks.Lock interface
must implement.
Describes some of the expected
characteristics of each of the
methods of this interface.
5 points
Explains what the JVM does when it
encounters a synchronized directive.
10 points
Explains difference between Lock
interface and synchronized keyword.
Does not describe some of the expected
characteristics of each of the methods of
this interface.
0 points
Does not explain what the JVM does when
it encounters a synchronized directive.
0 points
Does not explains difference between
Lock interface and synchronized keyword.
3

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Calculate your order
275 words
Total price: $0.00

Top-quality papers guaranteed

54

100% original papers

We sell only unique pieces of writing completed according to your demands.

54

Confidential service

We use security encryption to keep your personal data protected.

54

Money-back guarantee

We can give your money back if something goes wrong with your order.

Enjoy the free features we offer to everyone

  1. Title page

    Get a free title page formatted according to the specifics of your particular style.

  2. Custom formatting

    Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.

  3. Bibliography page

    Don’t pay extra for a list of references that perfectly fits your academic needs.

  4. 24/7 support assistance

    Ask us a question anytime you need to—we don’t charge extra for supporting you!

Calculate how much your essay costs

Type of paper
Academic level
Deadline
550 words

How to place an order

  • Choose the number of pages, your academic level, and deadline
  • Push the orange button
  • Give instructions for your paper
  • Pay with PayPal or a credit card
  • Track the progress of your order
  • Approve and enjoy your custom paper

Ask experts to write you a cheap essay of excellent quality

Place an order

Order your essay today and save 30% with the discount code ESSAYHELP