This
assignment has TWO (2) questions.
Objectives
– The objective of this assessment is for you to demonstrate your
understanding of issues related to the design and use of sequential
and concurrent data structures and algorithms.
Question
1 – A group of chess players meet every week for chess games. They
want to record who has won a game against whom.
The
following games have been played:
Player
1 vs Player 2 – winner = Player 2
Player
2 vs Player 4 – winner = Player 4
Player
2 vs Player 6 – winner = Player 6
Player
3 vs Player 4 – winner = Player 3
Player
3 vs Player 5 – winner = Player 3
Player
5 vs Player 2 – winner = Player 2
Player
5 vs Player 6 – winner = Player 5
Player
6 vs Player 1 – winner = Player 1
Your
task is to decide what data structure/s would be best to store this
information. This can include any of the data structures studied in
the module, e.g. graphs, hash maps, trees, linked lists. When
selecting a data structure, think about what operations the chess
players might want to perform with the data, and which structures
would be more efficient for these operations.
(a)
Explain which data structure/s you chose and how it would store the
information. Be as specific as possible, e.g. if you chose to use a
graph, state clearly whether the graph will be implemented as an
adjacency matrix or adjacency lists, or if you used a hash map, state
what type the keys and values are.
(b)
Show, with the aid of diagrams or tables if appropriate, how the game
information given above, i.e. Player 1 vs 2 with winner = 2 and so
on, would be stored in your chosen structure.
(c)
Give two examples of operations that can be performed using your data
structure. Here are some suggestions:
-
Finding
whether a given player has won against another given player. -
Listing
the players that a given player has beaten. -
Listing
the players that a given player has lost to. -
Listing
all the games that have been played, including who played whom and
who won. -
Listing
the players that a given player has played against (won or lost).
For
each of the example operations you choose, explain how it would work
using the data structure/s you chose and what time complexity it
would have.
Question
2 – There is a bridge over a deep cavern. A group of people want to
cross, but the bridge is unstable and can only support at most two
people at one time. The code for the Person class is given below,
which represents a person crossing the bridge. It uses a shared
semaphore bridge.
Person
code:
wait(bridge);
cross();
signal(bridge);
(a)
There are four people, A, B, C and D, who want to cross the bridge.
Each person is an instance of the Person class. Demonstrate how the
semaphore prevents more than two people being on the bridge at the
same time by giving an example execution trace. Show the value of
bridge after each wait or signal step. Ensure that you state the
initial value of bridge.
If
a wait operation executes, indicate whether the process succeeds or
is placed in the queue. If a signal operation executes, indicate
whether the value is changed or a sleeping process is woken up. (7
marks)
(b)
The owner of the bridge wants to keep track of how many people cross
it. A shared variable count is used for this. Each Person instance
increments the count as they cross the bridge. The Person code is
changed to the following:
Person
code:
wait(bridge);
wait(mutex);
int
c = count;
count
= c + 1;
signal(mutex);
cross();
signal(bridge);
Give
an example trace to show what would happen if there was no mutex
semaphore but the count was still updated by each Person. Your trace
should show how an incorrect value for count could be obtained.
Assignment
2: JavaFX Final Year Module Chooser GUI
You
must develop the GUI using JavaFX (and not any other Java framework
such as Swing or AWT). Furthermore, you cannot use a GUI builder of
any kind. Failure to meet either of these two requirements will
result in an automatic mark of zero for this assignment.
Objectives
The
objective of this assessment is for you to demonstrate your ability
to design and implement an OO system consisting of a set of Java
classes, using advanced libraries within the Java SDK. In particular:
1.
To study and correctly make use of a prebuilt student profile data
model.
2.
To build a suitable user interface using JavaFX 8 libraries.
3.
To implement event handling procedures that provide a basis for an
interactive and user-friendly system.
4.
To adhere to standard principles of the Model-View-Controller (MVC)
design pattern and appropriately decompose classes through
abstraction and encapsulation.
JavaFX
Module Chooser GUI specification
A
student profile captures the details of an individual second year
undergraduate computing student and allows them to select their final
year module options. There are compulsory modules that must be
selected (depending on the course of study), and others that are only
associated with certain courses. Modules either run in term 1 or 2,
or all year long.
Your
task is to build an interactive graphical user interface (GUI) that
dynamically allows modules to be selected based on the chosen course
of study, and then stores this information. The application should be
user-friendly and contain appropriate validation to ensure only a
legitimate selection of modules is made.
For
this prototype, you are only required to use the data of two courses,
Computer Science and Software Engineering. However, the system should
be designed such that it would be relatively simple to add further
courses and modules in the future.
The
table overleaf shows all of the available modules, their credit
amount, and whether they are an option or compulsory for Computer
Science and Software Engineering students.
Computer
Science students have 45 compulsory credits, whereas Software
Engineering students have 60 compulsory credits. Computer Science
students can exclusively study IMAT3428.
In
total 120 credits must be selected via any legitimate combination of
modules, but crucially you may only select 60 credits per term. The
yearlong module IMAT3451 contributes towards 15 credits in each term.
The post understanding of issues related to the design appeared first on My Assignment Online.