Ask Programming Language Expert

Assignment 1 -

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.

Attachment:- Assignment Files.rar

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M92771262
  • Price:- $70

Guranteed 36 Hours Delivery, In Price:- $70

Have any Question?


Related Questions in Programming Language

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As