Task 1 (W8 - 10 marks) Code the class shell and instance variables for unit offered in a faculty. The class should be ca
Posted: Sat May 14, 2022 2:38 pm
Task 1 (W8 - 10 marks)
Code the class shell and instance variables for unit offered in
a faculty. The class should be called Unit. A
Unit instance has the following attributes:
unitCode: length of 7 characters (you can
assume all unit code is 7 characters in length)
unitName: length of 40 characters max
creditHour: represent by integer. Each unit has
6 credit hours by default unless specified.
offerFaculty: length of 20 characters. It will
be the name of the faculty that offer the unit (eg. Faculty of
IT).
offeredThisSemester?: Can be true or false (if
true – offered this semester, if false – not offered)
Task 2 (W8 - 5 marks)
Code a non default three-parameter constructor
with parameters for unit code, credit
hour and offer faculty. Instance
variables that are not taking parameter must be auto-initiliased
with sensible default value. The constructor must utilise
appropriate naming conventions and they protect the integrity of
the class's instance variables.
Task 3 (W8 - 5 marks)
Code the getter/accessor methods for all the
instance variables in task 1.
Task 4 (W8 - 20 marks)
Code the setter/mutator methods for all the
instance variables in task 1and at least one of the method should
return a boolean to indicate the success or failure of the
mutation. The code must protect the integrity of the class's
instance variables as required and utilise appropriate naming
conventions.
CODE USING INTELLIJ JAVA
Code the class shell and instance variables for unit offered in
a faculty. The class should be called Unit. A
Unit instance has the following attributes:
unitCode: length of 7 characters (you can
assume all unit code is 7 characters in length)
unitName: length of 40 characters max
creditHour: represent by integer. Each unit has
6 credit hours by default unless specified.
offerFaculty: length of 20 characters. It will
be the name of the faculty that offer the unit (eg. Faculty of
IT).
offeredThisSemester?: Can be true or false (if
true – offered this semester, if false – not offered)
Task 2 (W8 - 5 marks)
Code a non default three-parameter constructor
with parameters for unit code, credit
hour and offer faculty. Instance
variables that are not taking parameter must be auto-initiliased
with sensible default value. The constructor must utilise
appropriate naming conventions and they protect the integrity of
the class's instance variables.
Task 3 (W8 - 5 marks)
Code the getter/accessor methods for all the
instance variables in task 1.
Task 4 (W8 - 20 marks)
Code the setter/mutator methods for all the
instance variables in task 1and at least one of the method should
return a boolean to indicate the success or failure of the
mutation. The code must protect the integrity of the class's
instance variables as required and utilise appropriate naming
conventions.
CODE USING INTELLIJ JAVA