Cashback Offer (20th - 30th September 2020). Get Flat 10% Cashback credited in your account on a minimum transaction of $80. Post Your Question

Question DetailsNormal
$ 70.00

Java Assessment item 3 : Task 1, Task 2, & Task 3

Question posted by
Online Tutor Profile

Assessment item 3

Assignment 3

Value: 20%

Submission method options

Alternative submission method


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.
    • 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. 
    • 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.
    • 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.
    • 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.


    • 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.



Available Answer
$ 70.00

[Solved] Java Assessment item 3 : Task 1, Task 2, & Task 3

  • This solution is not purchased yet.
  • Submitted On 31 Aug, 2020 07:26:28
Answer posted by
Online Tutor Profile
Java Programming a...
Buy now to view the complete solution
Other Similar Questions
User Profile

Java Assessment item 3 : Task 1, Task 2, & Task 3

Java Programming are completed and attached below Please find the solution...
User Profile

Java Assessment item 2 : Task 1 & Task 2

Java Program is completed and attached with solutions...
User Profile

Java Assessment item 1 : Task 1 & Task 2

Java Programming solution is attached with the file...

The benefits of buying study notes from CourseMerit

Assurance Of Timely Delivery
We value your patience, and to ensure you always receive your homework help within the promised time, our dedicated team of tutors begins their work as soon as the request arrives.
Best Price In The Market
All the services that are available on our page cost only a nominal amount of money. In fact, the prices are lower than the industry standards. You can always expect value for money from us.
Uninterrupted 24/7 Support
Our customer support wing remains online 24x7 to provide you seamless assistance. Also, when you post a query or a request here, you can expect an immediate response from our side.

$ 629.35