Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Scenario MONASH UNIVERSITY WOULD LIKE TO CREATE AN APP TO MANAGE UNIT (SUBJECT) OFFERED BY FACULTY IN EVERY SEMESTER. THIS APP WILL CONSIST THE

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Scenario MONASH UNIVERSITY WOULD LIKE TO CREATE AN APP TO MANAGE UNIT (SUBJECT) OFFERED BY FACULTY IN EVERY SEMESTER. THIS APP WILL CONSIST THE DETAILS OF THE UNIT. YOU ARE REQUIRED TO DESIGN A JAVA CLASS FOR THE APP BASED ON THE SPECIFICATIONS AS BELOW TASKS 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 credit Hour: represent by integer. Each unit has 6 credit hours by default unless specified. offer Faculty: length of 20 characters. It will be the name of the faculty that offer the unit (eg. Faculty of IT). offered ThisSemester?: 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 7 (W8 - 5 marks) Write the main method code in a UnitDriver class that instantiates Unit objects to test successful and unsuccessful attempt as below. ==Successful Attempt= Unit Code: FIT1051 Offered Faculty: Faculty of IT Credit Hour: 6 Offered in this Semester? : true =======Unsuccessful Attempt======= Unit Code: null Offered Faculty: FIT Credit Hour: 0 Offered in this Semester? : true Code Readability (5 marks) Overall code submission must be well organised and very easy to follow included but not limited to code indentation, code consistency, effective use of whitespace etc. Task 6 (W8 - 10 marks) Code a two parameters method called customCreditHour that takes in a unit code and number of credit hours. This method should use the parameters and check if the first 3 character of the unit code is not "FIT", then accept the unit code and number of credit hours. If the first 3 character is "FIT", then it should prompt an error message "Error. This is FIT unit and the no of credit hours is 6 by default" e.g. calling the method customCreditHour("FIT1051", 12) will return "Error. This is FIT unit and the no of credit hours is 6 by default" . Declare your variables as appropriate. You may assume any unit which is not offered by FIT should not be 6 credit hours by default. Task 7 (W8 - 5 marks) Write the main method code in a UnitDriver class that instantiates Unit objects to test successful and unsuccessful attempt as below. ======Successful Attempt=: Unit Code: FIT1051 Offered Faculty: Faculty of IT Credit Hour: 6 Offered in this Semester?: true =======Unsuccessful Attempt======= Unit Code: null Offered Faculty: FIT 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. Task 5 (W8 - 5 marks) Code a toString method for the class that output as below. Unit Code: FIT1051 | Offered Faculty: Faculty of IT Credit Hour: 6 Offered in this Semester? : true Task 6 (W8 - 10 marks) Code a two parameters method called customCreditHour that takes in a unit code and number of credit hours. This method should use the parameters and check if the first 3 character of the unit code is not "FIT", then accept the unit code and number of credit hours. If the first 3 character is "FIT", then it should prompt an error message "Error. This is FIT unit and the no of credit hours is 6 by default"

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Statistics

Authors: Robert A. Donnelly

2nd Edition

0321925122, 978-0321925121

More Books

Students also viewed these Programming questions