We're Open
+44 7340 9595 39
+44 20 3239 6980

CREATE A SUBJECT CLASS WHOSE INSTANCES WILL REPRESENT THE SUBJECTS FOR STUDY AT A UNIVERSITY

  100% Pass and No Plagiarism Guaranteed

CREATE A SUBJECT CLASS WHOSE INSTANCES WILL REPRESENT THE SUBJECTS FOR STUDY AT A UNIVERSITY

Task

Task 1

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

In this task, you are required to provide complete class definitions and then create instances of various classes and use methods to perform various tests.

(a) Define an abstract class called Textbook with the following fields and methods:

  • Fields: title, author, pages representing the title, author and the number of pages of a textbook for a given book respectively. Encapsulation should be used to protect these fields against intentional or accidental, direct modification
  • Constructors: a no-args default constructor, and an overloaded constructor to initialise the fields to appropriate values when the instances of the class are created
  • Methods: a toString() method to print a string representation of the objects, get and set methods to provide access to each of the three fields

(b) Define a subclass of the Textbook class called ProgrammingTextbook with the following additional field and methods:

  • Field: language representing the particular language the programming textbook uses. Again, encapsulation should be used to protect this field against intentional or accidental, direct modification
  • Constructors: a no-args default constructor, and an overloaded constructor to initialise the fields to appropriate values when the instances of the class are created
  • Methods: a toString() method to print a string representation of the objects, additional get and set methods as required to provide access to the field

(c) Define another subclass of the Textbook class called EngineeringTextbook with the following additional field and methods:

  • Field: subject representing the particular engineering subject the textbook teaches. Again, encapsulation should be used to protect this field against intentional or accidental, direct modification
  • Constructors: a no-args default constructor, and an overloaded constructor to initialise the fields to appropriate values when the instances of the class are created
  • Methods: a toString() method to print a string representation of the objects, additional get and set methods as required to provide access to the field

(d) Finally, define another class called TestTextbooks with a main() method to perform necessary testing for the classes defined in the previous sections. In the main method, write the code to create at least two objects of the ProgrammingTextbook class and at least two other objects of the EngineeringTextbook class. Create an ArrayList object to store references to these objects and then test various methods of the objects using loop(s) and methods as necessary.

Ensure that the program is appropriately documented throughout and thoroughly tested to demonstrate its correct operation.

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)

Marking Criteria

 

Assessment 3 (Total marks 20)

Task 1 (total marks 12)

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 (3), TestSubject (3), and file read/write (3) classes are implemented as specified, showing good logic.

9.0

Implement and integrate Subject and TestSubject classes with some functions using file read & write (4.5)

Implement and integrate Subject and TestSubject classes with majority of the functions using file read & write (6)

Implement and integrate Subject and TestSubject classes with majority of the functions using file read & write (7)

Implement and integrate Subject and TestSubject classes with all functions using file read & write maintaining logical flow (9)

c.     Presentation: Code uses good style (identifier naming, indentation, header and inline 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 outputs (0.75)

Provide all components within the specified word length(1.5)

Task 2 (total marks 8)

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: Textbook, ProgrammingTextbook, EngineeringTextbook and TestTextbooks classes are implemented as specified, showing good logic.

4.5

Implement and integrate the required classes with some of the functionality using super/sub class relationship (1.25)

Implement and integrate the required classes with majority of the functionality using super/sub class relationship (3.0)

Implement and integrate the required classes with all of the functionality using super/sub class relationship maintaining logical flow (4.5)

c.     UML design for classes.

1.5

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.5)

d.    Presentation: Code uses good style (identifier naming, indentation, header and inline comments)

0.5

few comments and minor indentation errors (0.25)

Proper indentation and comments in each block and major lines (0.5)

e.    Submission: The document with all components (analysis, testing, and output)

1.0

Provide sample outputs (0.25)

Provide all components within the specified word length with good explanation (1.0)

               


Presentation

Material to submit for Assignment 3:

You need to submit a single zip file containing ALL of the required assignment documents including the java and class files as well as the test documents.


100% Plagiarism Free & Custom Written,
Tailored to your instructions


International House, 12 Constance Street, London, United Kingdom,
E16 2DQ

UK Registered Company # 11483120


100% Pass Guarantee

STILL NOT CONVINCED?

View our samples written by our professional writers to let you comprehend how your work is going to look like. We have categorised this into 3 categories with a few different subject domains

View Our Samples

We offer a £ 2999

If your assignment is plagiarised, we will give you £ 2999 in compensation

Recent Updates

Details

  • Title: CREATE A SUBJECT CLASS WHOSE INSTANCES WILL REPRESENT THE SUBJECTS FOR STUDY AT A UNIVERSITY
  • Price: £ 109
  • Post Date: 2018-11-09T11:08:04+00:00
  • Category: Assignment
  • No Plagiarism Guarantee
  • 100% Custom Written

Customer Reviews

 CREATE A SUBJECT CLASS WHOSE INSTANCES WILL REPRESENT THE SUBJECTS FOR STUDY AT A UNIVERSITY CREATE A SUBJECT CLASS WHOSE INSTANCES WILL REPRESENT THE SUBJECTS FOR STUDY AT A UNIVERSITY
Reviews: 5

A masterpiece of assignment by , written on 2020-03-12

My psychology assignment just came on time and the overall quality is good. It’s also free from errors. I simply loved it!
Reviews: 5

A masterpiece of assignment by , written on 2020-03-12

I am not good at designing PowerPoint presentations so I took help from Insta Research. The format is cool and attractive. All the information is nicely placed and used. I am looking forward to presenting so that I could demonstrate my presentation and receive good comments. Thank you for help.