Recent Question/Assignment

Task
Assessment 3 has 20 marks in total. Marks will be scaled according to the value of the assignment. Assessment 3 has four Tasks. Task 1 is to create subject class and test its properties, Task 2 is to create Octagon class from super classes and then test its properties, Task 3 is to display a frame using GUI, and Task 4 is to investigate on various programming paradigm.
Task 1
Value: 8 marks
For this task you will create a Subject class, whose instances will represent the subjects for study at a university. A subject will have a name, just a String, and a subject code, which is a six-character String. The first three characters of a subject code are alphabetic and the last three are numeric. The first three characters define the subject's discipline area. A subject code must be unique.
You will also write a TestSubject class to test the use of your Subject class. In particular this will maintain an array of subjects. In order to manage the uniqueness of the subject codes, your program will need to display information about existing subject codes as well as checking that any new subject code supplied by the user is not the same as any existing subject code.
The following state and functionality should be provided for the Subject class:
• Two fields will hold the subject’s name and the six-character subject code.
• A constructor will allow a name and a new, validated subject code to be provided when a new subject is created.
• Getters will provide access to the attributes.
• An accessor method called getDiscipline will return a string containing the first three characters of the subject code.
• Another accessor method called codeMatches will return a boolean value indicating if the subject's code matches the string argument provided. -Matches- is used here in the same sense as for the matches method of the String class.
• A toString method will return a string containing the subject code and subject name.
To assist with managing subject codes and their uniqueness you will provide the Subject class with some class methods as follows:
• An allDisciplines method will accept an array of Subject objects. It will return an array containing the different 3-character discipline codes represented in the array of subjects in alphabetically order.
• A codesPerDiscipline method will accept an array of Subject objects and a 3-character discipline code. It will return an array containing the different subject codes represented in the array of subjects for the particular discipline.
• An isValidCode method will accept a string that is a possible new subject code, and return a boolean indicating whether it satisfies the structural requirements for a subject code.
• A codeExists method will accept an array of Subject objects and a possible new subject code. It will return a boolean indicating whether that code has already been allocated to one of the subjects in the array.
• A sortDisciplines method will accept an array of Subjects objects. It will return the sorted array of subjects in alphabetically order.
Your TestSubject program will perform the following sequence of actions, using good design techniques such as in the appropriate use of methods:
• An initial array of Subject objects will be created from any data in a file that was previously saved by the program.
• The user interaction will then proceed to allow the user to add one or more new subjects to the array. If the user wishes to add new subjects, the discipline areas of existing subjects should be displayed in alphabetically order. The user will then enter a discipline code to which the program will respond by displaying any existing subject codes in that discipline. This procedure simplifies the user’s task of choosing subject codes that do not already exist, but does not prevent user mistake. Each subject code entered by the user should be checked. The user can enter any new subjects in that discipline (or indeed in other disciplines). The user should be given the choice of repeating the processing for other discipline areas.
• When the user has finished adding subjects, and only if subjects have indeed been added, the program will overwrite the data file with the updated data.
Note:
• You may use an ArrayList to implement an array if you prefer and it is appropriate.

Task 2
Value: 5 marks

Design a class named Octagon that extends GeometricObject class and implements the Comparable and Cloneable interface. Assume that all eight sides of the octagon are of equal size. The area can be computed using following formula:

Draw the UML diagram that involves Octagon, GeometricObjects, Comparable, and Cloneable. Write a test program that creates an Octagon object with side values 5 and display its area and perimeter. Create a new object using clone method and compare the two objects using compareTo method.

GeometricObject class can be found in textbook. It is also given below.

Task 3

Value: 4 marks

Write a Java programs which displays a frame that contains three labels. Each label displays a card, as shown in the figure below. The card image files are named 1.png, 2.png, ..., 54.png and stored in the image/card directory. All three cards are distinct and selected randomly.

The image icons used in the questions are available in the Resource folder of Interact

Your Task:
1. Create three JLabel and set their icons using the images.
2. Display three images from 54 image cards randomly.

Task 4

Value: 3 marks

Investigate the imperative programming paradigm, as exemplified by procedural programming and object-oriented programming, and the declarative programming paradigm, as exemplified by functional programming and logic programming.

The Reading from Brookshear, 2012 will form a starting point for your investigation. For further investigation, remember that you should not reference Wikipedia items in an essay, so make sure to find articles that you can reference.

Write an essay, of approximately 800 words, based on your investigation, which provides answers to the following questions:
• What are the essential differences between the paradigms?
• What are some of the programming languages used for these different paradigms?
• What specific advantages are provided by these different programming approaches?

Your essay should be referenced using the APA referencing style.

Rationale
This assignment has been designed to allow students to test and demonstrate their ability to:
• to interpret and evaluate design requirements expressed in Unified Modelling Language (UML) (objective 2);
• to apply inheritance and aggregation patterns in the design and implementation of programs (Objective 3);
• be able to compare and critically evaluate different programming paradigms (Objective 6);
• to manipulate file operations through Java programming; (objective 7);
• to use object-oriented techniques and Java resources to develop small applications consisting of a number of classes (objective 4);
• to implement Graphical User Interface) (GUI )components using Java (objective 8).
Marking criteria
These criteria will be used to evaluate Assignment 3:
• The tasks are performed as specified and the assignment is submitted as required
• Appropriate understanding of the subject area is demonstrated, including correct use of approriate techniques
• Explanations and discussions are cogent and use clear and correct English expression
• Referencing is used where appropriate
Marking guide of the specific tasks:

Assessment 3 (Total marks 20)
Task 1 (total marks 8)
Criteria Marks Pass CR DI HD
a. Execution: Program launches, executes and terminates without crashing; program executes as specified. 1.0 Provide java files. They execute without crashing towards intended output (1.0)
b. Program design & implementation: Subject (4), TestSubject (3), and file read/write (2) classes are implemented as specified, showing good logic. 5.0 Implement and integrate Subject and TestSubject classes with some functions using file read & write (2.5) Implement and integrate Subject and TestSubject classes with majority of the functions using file read & write (3.5) Implement and integrate Subject and TestSubject classes with majority of the functions using file read & write (4) Implement and integrate Subject and TestSubject classes with all functions using file read & write maintaining logical flow (5)
c. Presentation: Code uses good style (indentation, comments) 0.5 Few comments and minor indentation errors (0.25) Proper indentation &comments in each block and major lines (0.5)
d. Submission: the documents with all components (analysis, testing, and output) 1.5 Provide sample output (0.75) Provide all components within the specified word length(1.5)
Task 2 (total marks 5)
Criteria Marks Pass CR DI HD
a. Execution: Program launches, executes and terminates without crashing; program executes as specified. 0.5 Provide java files. They execute without crashing towards intended output (0.5)
b. Program design & implementation: Octagon (1.5) and TestOctagon(1) classes are implemented as specified, showing good logic. 2.5 Implement and integrate Octagon and TestOctagon classes with some functions using super/sub class relationship (1.25) Implement and integrate Octagon and TestOctagon classes with majority functions using super/sub class relationship (1.75) Implement and integrate Octagon and TestOctagon classes with all functions using super/sub class relationship maintaining logical flow (2.5)
c. UML design: For classOctagon. 1.0 UML with all components (0.5) UML with all components and their modifier, argument, and return type with minor error (0.75) UML with all components and their modifier, argument, and return type (1.0)
d. Presentation: Code uses good style (indentation, comments) 0.5 few comments and minor indentation errors (0.25) Proper indentation &comments in each block and major lines (0.5)
e. Submission: The document with all components (analysis, testing, and output) 0.5 Provide sample output (0.25) Provide all components within the specified word length with good explanation (0.5)
Task 3 (total marks 4)
Criteria Marks Pass CR DI HD
a. Execution: Program launches, executes and terminates without crashing; program executes as specified. 0.5 Provide java file(s). Program executes without crashing towards intended output (0.5)
b. Program design & implementation: Frame (1) and Component(1.5) are implemented as specified, showing good logic. 2.5 Display frame, labels and images (1.25) Display frame, labels and images by using randomly with some error (1.75) Display frame, labels and images by using randomly with minor logical error (2) Display frame, labels and images by using randomly with logical flow (2.5)
c. Presentation: Code uses good style (indentation, comments) 0.5 Few comments and minor indentation errors (0.25) Proper indentation &comments in each block and major lines (0.5)
d. Submission: The document with all components (analysis, testing, and output) 0.5 Provide sample output (0.75) Provide all components within the specified word length(1.5)
Task 4 (Total marks 3)
Criteria Marks Pass CR DI HD
a. Essential differences between the paradigms: 1.0 Mention names and their definitions (0.5) Identify different paradigms chronologically or based on the modernization of requirement (1)
b. Example of programming languages in paradigms 1.0 Mention program language names against each paradigm (0.5) Mention program language names against each paradigm with some criteria (1)
c. Advantages of different programming approaches 1.0 At least one advantage of each paradigm (0.5) At least two advantage of each paradigm (1)
Presentation
Material to submit for Task 1

1. You need to submit the java and class files
2. You also need to submit a doc/pdf file with following information:
a. Analysis: Describe the problem including input and output in your own words (not more than 400 words)
b. Testing: Describe how you test this program (not more than 400 words)
c. Output: Copy and paste a snapshot of the program output

Material to submit for Task 2

1. You need to submit the java and class files
2. You also need to submit a doc/pdf file with following information:
a. Analysis: Describe the problem including input and output in your own words (not more than 400 words)
b. Testing: Describe how you test this program (not more than 400 words)
c. Output: Copy and paste a snapshot of the program output
Material to submit for Task 3
1. You need to submit the java and class files
2. You also need to submit a doc/pdf file with following information:
a. Analysis: Describe the problem including input and output in your own words (not more than 400 words)
b. Testing: Describe how you test this program (not more than 400 words)
c. Output: Copy and paste a snapshot of the program output

Material to submit for Task 4
1. You need to submit a doc/pdf file which includes the easy.

Requirements
To complete this assignment you might need to have covered material up to and including the topic Inheritance and Polymorphism, abstract classes and interfaces, Thinking of Objects, GUI basics, and UML in the Text Book and module.