0% found this document useful (0 votes)
302 views60 pages

CS4001NI Programming Coursework Overview

RETURN salary * workingHour END DO Pseudocode for PartTimeStaffHire is given below: DO DECLARE hourlyRate DECLARE workingHour DECLARE isTerminated DECLARE staffName DECLARE joiningDate DECLARE qualification DECLARE appointedBy DECLARE hasjoined 9 Nitesh Poudel CS4001NI Programming CALL PartTimeStaffHire with parameters DO ASSIGN super with parameters ASSIGN hourlyRate ASSIGN workingHour ASSIGN isTerminated AS false ASSIGN staffName AS “” ASSIGN joiningDate AS “” ASSIGN qualification AS

Uploaded by

cybostreams
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
302 views60 pages

CS4001NI Programming Coursework Overview

RETURN salary * workingHour END DO Pseudocode for PartTimeStaffHire is given below: DO DECLARE hourlyRate DECLARE workingHour DECLARE isTerminated DECLARE staffName DECLARE joiningDate DECLARE qualification DECLARE appointedBy DECLARE hasjoined 9 Nitesh Poudel CS4001NI Programming CALL PartTimeStaffHire with parameters DO ASSIGN super with parameters ASSIGN hourlyRate ASSIGN workingHour ASSIGN isTerminated AS false ASSIGN staffName AS “” ASSIGN joiningDate AS “” ASSIGN qualification AS

Uploaded by

cybostreams
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module Code & Module Title

CS4001NI - Programming (Computing)

Assessment Weightage & Type

30% Individual Coursework

Year and Semester

2019-20 Autumn

Student Name: Nitesh Poudel

Group: L1C12

London Met ID: 19031252

College ID: NP01CP4A190312

Assignment Due Date: January 13

Assignment Submission Date: January 13

I confirm that I understand my coursework needs to be submitted online via Google


Classroom under the relevant module page before the deadline in order for my
assignment to be accepted and marked. I am fully aware that late submissions will be
treated as non-submission and a mark of zero will be awarded.
Contents

1. Introduction....................................................................................................... 2
2. Class diagram................................................................................................... 3
3. Pseudocode....................................................................................................... 4
4. Method Description......................................................................................... 19
5. Testing............................................................................................................ 21
6. Error Detection................................................................................................ 26
I. Syntax Error................................................................................................. 26
II. Runtime Error.............................................................................................. 27
III. Logical Error.............................................................................................. 28
7. Conclusion....................................................................................................... 31
8. Appendix......................................................................................................... 32
9. Bibliography.................................................................................................... 59
CS4001NI Programming

List of Figures:

S.N Name Page No.


.
1 Class diagram and relationship between different classes 4
2 Object of FullTimeStaffHire class 22
3 Inspection of object of PartTimeStaffHire class 23
4 Inspection of object of PartTimeStaffHire class after changing the 24
isTerminated to true
5 Displayed values of FullTimeStaffHire class 25
6 Displayed values of PartTimeStaffHire class 26
7 Syntax Error 27
8 Correction of Syntax Error 28
9 Runtime Error 28
10 Correction of Runtime Error 29
11 Logical Error 29
12 Logical Error followed while creating object 30
13 Logical Error followed while inspecting the object 30
14 Correction of Logical Error 31

List of Tables:

S.N Name Page No.


.
1 Method Description of the class StaffHire 20
2 Method Description of the class FullTimeStaffHire 20
3 Method Description for the class PartTimeStaffHire 21
4 Test 1 22
5 Test 2 23
6 Test 3 24
7 Test 4 25

1
Nitesh Poudel
CS4001NI Programming

1. Introduction

Java is an object oriented high level language developed by Sun


Microsystems in 1995. Java is a platform independent programming
language meaning it could run in any operating system namely any
version of UNIX including MacOS, Windows and so on.

This individual coursework which was given to us during week 8 is


based on writing program on Java. This coursework values 30% of our
module grade.

The teacher guided us throughout the project and taught us


different aspects of doing the coursework. This program is used to
appoint new staff in the organization. The project consists of three
classes namely: StaffHire, FullTimeStaffHire, and PartTimeStaffHire.
StaffHire being the parent class and FullTimeStaffHire,
PartTimeStaffHire being child classes. Different methods are used in the
program notably assessor method which takes up big real state of the
source code. Class diagram, pseudocode, method description of a
program is also given below.

The main objective of the given coursework is given below:

 To create a class diagram of the created classes.


 To write the pseudocode of the written source code.
 To give the discrete description of the method written in
the sourcecode.
 To perform all the test stated
 To describe what error detection means and explain
different types of it.

2
Nitesh Poudel
CS4001NI Programming

2. Class diagram

Figure 1: Figure featuring the class diagram and relationship between different classes

3
Nitesh Poudel
CS4001NI Programming

3. Pseudocode
Pseudocode for StaffHire is given below:

DO

DECLARE vacancyNumber

DECLARE designation

DECLARE jobType

CALL StaffHire with parameters

DO

ASSIGN vacancyNumber

ASSIGN designation

ASSIGN jobType

END DO

CALL getVacancyNumber

DO

RETURN vacancyNumber

END DO

CALL setVacancyNumber with parameters

DO

ASSIGN vacancyNumber

END DO

‘CALL getDesignation

DO

4
Nitesh Poudel
CS4001NI Programming

RETURN designation

END DO

CALL setDesignation with parameters

DO

ASSIGN designation

END DO

‘CALL getJobType

DO

RETURN jobType

END DO

CALL setJobType with parameters

DO

ASSIGN jobType

END DO

CALL displayStaffHire with peremeters

DO

PRINT vacancyNumber

PRINT designation

PRINT jobType

END DO

END DO

Pseudocode for FullTimeStaffHire is given below:

5
Nitesh Poudel
CS4001NI Programming

DO

DECLARE salary

DECLARE workingHour

DECLARE staffName

DECLARE joiningDate

DECLARE qualification

DECLARE appointedBy

DECLARE hasjoined

CALL FullTimeStaffHire with parameters

DO

ASSIGN super with parameters

ASSIGN salary

ASSIGN workingHour

ASSIGN staffName AS “”

ASSIGN joiningDate AS “”

ASSIGN qualification AS “”

ASSIGN appointedBy AS “”

ASSIGN hasJoined AS false

END DO

CALL getSalary

6
Nitesh Poudel
CS4001NI Programming

DO

RETURN salary

END DO

CALL setSalary with parameters

DO

ASSIGN salary

END DO

CALL getworkingHour

DO

RETURN workingHour

END DO

CALL setworkingHour with parameters

DO

ASSIGN workingHour

END DO

CALL getStaffName

DO

RETURN staffName

END DO

CALL setStaffName with parameters

DO

ASSIGN staffName

7
Nitesh Poudel
CS4001NI Programming

END DO

CALL getJoiningDate

DO

RETURN joiningDate

END DO

CALL setJoiningDate with parameters

DO

ASSIGN joiningDate

END DO

CALL getQualification

DO

RETURN qualification

END DO

CALL setQualification with parameters

DO

ASSIGN qualification

END DO

CALL getAppointedBy

DO

RETURN appointedBy

END DO

CALL setAppointedBy with parameters

8
Nitesh Poudel
CS4001NI Programming

DO

ASSIGN appointedBy

END DO

CALL getIsJoined

DO

RETURN isjoined

END DO

CALL setIsJoined with parameters

DO

ASSIGN joined

END DO

CALL salary with parameters

DO

IF hasJoined is FALSE

ASSIGN salary

END IF

END DO

DO

ELSE

PRINT “Staff has already joined”

END ELSE

END DO

9
Nitesh Poudel
CS4001NI Programming

CALL workingHour with parameters

DO

IF hasJoined is FALSE

ASSIGN workingHour

END IF

END DO

DO

ELSE

PRINT “Staff has already joined.”

ELSE IF

END DO

CALL hireFullTimeStaff with parameters

DO

IF hasJoined is FALSE

ASSIGN staffName

ASSIGN joiningDate

ASSIGN qualification

ASSIGN appointedBy

ASSIGN hasJoined

10
Nitesh Poudel
CS4001NI Programming

END IF

END DO

ELSE

DO

PRINT “Staff Have already joined.”

END DO

END DO

CALL displayStaffHire

DO

IF hasJoined is TRUE

CALL [Link]

PRINT staffName

PRINT salary

PRINT joiningDate

PRINT qualification

PRINT appointedBy

END IF

END DO

END DO

END DO

11
Nitesh Poudel
CS4001NI Programming

Pseudocode for PartTimeStaffHire is given below:

DO

DESCRIBE workingHour

DESCRIBE wagesPerHour

DESCRIBE staffName

DESCRIBE joiningDate

DESCRIBE qualification

DESCRIBE appointedBy

DESCRIBE shifts

DESCRIBE hasJoined

DESCRIBE isTerminated

CALL PartTimeStaffHire with parameters

DO

ASSIGN super with parameters

ASSIGN workingHour

ASSIGN wagesPerHour

ASSIGN shifts

ASSIGN staffName AS “”

ASSIGN joiningDate AS “”

ASSIGN qualification AS “”

ASSIGN appointedBy AS “”

12
Nitesh Poudel
CS4001NI Programming

ASSIGN hasJoined AS false

ASSIGN isTerminated AS false

END DO

CALL getWorkingHour

DO

RETURN workingHour

END DO

CALL setWorkingHour with parameter

DO

ASSIGN workingHour

END DO

CALL getWagesPerHour

DO

RETURN wagesPerHour

END DO

CALL setWorkingHour with parameters

DO

ASSIGN wagesPerHour

END DO

CALL getStaffName

DO

RETURN staffName

13
Nitesh Poudel
CS4001NI Programming

END DO

CALL setStaffName with parameters

DO

ASSIGN staffName

END DO

CALL getJoiningDate

DO

RETURN joiningDate

END DO

CALL setJoiningDate with parameters

DO

ASSIGN joiningDate

END DO

CALL getQualification

DO

RETURN qualification

END DO

CALL setQualification with parameters

DO

ASSIGN qualification

END DO

CALL getAppointedBy

14
Nitesh Poudel
CS4001NI Programming

DO

RETURN appointedBy

END DO

CALL setAppointedBy with parameters

DO

ASSIGN appointedBy

END DO

CALL getShifts

DO

RETURN shifts

END DO

CALL setShifts with parameters

DO

ASSIGN shifts

END DO

CALL getIsTerminated

DO

RETURN isTerminated

END DO

CALL setIsTerminated with parameters

DO

ASSIGN isterminated

15
Nitesh Poudel
CS4001NI Programming

END DO

CALL setNewShifts with parameters

DO

IF joined is FALSE

ASSIGN shifts

END IF

END DO

DO

ELSE

PRINT “Staff has already joined.”

END ELSE

END DO

CALL hirePartTimeStaff with parameters

DO

IF joined is FALSE

ASSIGN staffName

ASSIGN joiningDate

ASSIGN qualification

ASSIGN appointedBy

ASSIGN hasJoined as TRUE

END IF

END DO

16
Nitesh Poudel
CS4001NI Programming

CALL terminatePartTimeStaff

DO

IF isTerminated is TRUE

PRINT “Staff has already joined”

END ID

END DO

DO

ELSE

ASSIGN isTerminated as TRUE

ASSIGN hasJoined as FALSE

ASSIGN staffName as “”

ASSIGN joiningDate as “”

ASSIGN qualification as “”

ASSIGN appointedBy as “”

END ELSE

END DO

CALL displayStaffHire

DO

IF joined is TRUE

PRINT staffName

PRINT wagesPerHour

PRINT workingHour

17
Nitesh Poudel
CS4001NI Programming

PRINT joiningDate

PRINT qualification

PRINT appointedBy

PRINT workingHour * wagesPerHour

END IF

END DO

END DO

END DO

4. Method Description

Method Description

18
Nitesh Poudel
CS4001NI Programming

getVacancyNumber This method is used to return vacancyNumber


getDesignation This method is used to return designation
getJobType This method is used to return jobType
setVacancyNumber This method is used to set new value for vacancyName
setDesignation This method is used to set new value for
designationNumber
setJobType This method is used to set new value for jobType

Table 1: Table featuring Method Description of the class StaffHire

Method Description
getSalary This method is used to return salary
getWorkingHour This method is used to return workingHour
getStaffName This method is used to return staffName
getJoiningDate This method is used to return joiningDate
getQualification This method is used to return qualification
getAppointedBy This method is used to return appointedBy
isJoined This method is used to return joined
setSalary This method is used to set new value for salary
setWorkingHour This method is used to set new value for workingHour
setStaffName This method is used to set new value for staffName
setJoiningDate This method is used to set new value for joiningDate
setQualification This method is used to set new value for qualification
setAppointedBy This method is used to set new value for appointedBy
setJoined This method is used to set new value for joined
salary method that sets the change in salary incase staff have not
joined
workingHour method that sets the working hour if staff have not joined
hireFullTimeStaff method that assigns information about staff if he haven't
joined
displayStaffHire method that displays information of staff if he have joined

Table 2: Table featuring Method Description for the class FullTimeStaffHire

Method Description
getWorkingHour This method is used to return workingHour
getWagesPerHour This method is used to return wagesPerHour

19
Nitesh Poudel
CS4001NI Programming

getStaffName This method is used to return staffName


getJoiningDate This method is used to return joiningDate
getQualification This method is used to return qualification
getAppointedBy This method is used to return appointedBy
getShifts This method is used to return shifts
getHasJoined This method is used to return hasJoined
getIsTerminated This method is used to return isTreminated
setWorkingHour This method is used to set new value for workingHour
setWagesPerHour This method is used to set new value for wagesPerHour
setStaffName This method is used to set new value for staffName
setJoiningDate This method is used to set new value for joiningDate
setQualification This method is used to set new value for qualification
setAppointedBy This method is used to set new value for appointedBy
setShifts This method is used to set new value for shifts
setHasJoined This method is used to set new value for hasJoined
setIsTerminated This method is used to set new value for isTerminated
setNewShift method that defines the shift of a staff who havent joined
hirePartTimeStaff method that assigns information about staff who havent
joined
terminatePartTimeSt method that assigns information about staff that have not
aff been terminated
displayStaffHire method that displays information about staff if they have
joined

Table 3: Table featuring Method Description for the class PartTimeStaffHire

20
Nitesh Poudel
CS4001NI Programming

5. Testing

Test No 1
Objective Inspect FullTimeStaffHire Class, appoint the full time staff, and
re-
inspect the FullTimeStaffHire Class
Action Constructor is called.
Input vacancyNumber in form of int
Input designation in form of String
Input jobType inform of String
Input salary in form of int
Input workingHour in form of int
Object was inspected again after assigning all the values

Expected result Creation of an object followed by assignation of values


Actual outcome Expected result was obtained
Final result Test was successful
Table 4: Table featuring Test 1

Figure 2: Figure featuring the inspection of object of FullTimeStaffHire class

21
Nitesh Poudel
CS4001NI Programming

Test No 2
Objective Inspect PartTimeStaffHire Class, appoint part time staff, and re-
inspect the PartTimeStaffHire Class
Action Constructor is called.
Input vacancyNumber in form of int
Input designation in form of String
Input jobType inform of String
Input workingHour in form of int
Input wagesPerHour in form of int
Input shifts in form of String
Object was inspected again after assigning all the values

Expected result Creation of an object followed by assignation of values


Actual outcome Expected result was obtained
Final result Test was successful
Table 5: Table featuring Test 2

Figure 3: Figure featuring the inspection of object of PartTimeStaffHire class

22
Nitesh Poudel
CS4001NI Programming

Test No 3
Objective Inspect PartTimeStaffHire Class, change the termination status
of a
staff, and re-inspect the PartTimeStaffHire Class
Action Constructor is called.
Input vacancyNumber in form of int
Input designation in form of String
Input jobType inform of String
Input workingHour in form of int
Input wagesPerHour in form of int
Input shifts in form of String
Changed isTerminated to true
Object was inspected again after assigning all the values

Expected result Creation of an object followed by assignation of values


Actual outcome Expected result was obtained
Final result Test was successful
Table 6: Table featuring Test 3

Figure 4: Figure featuring the inspection of object of PartTimeStaffHire class after


changing the isTerminated to true

23
Nitesh Poudel
CS4001NI Programming

Test No 4
Objective Display the detail of FullTimeStaffHire and PartTimeStaffHire
Class
Action Object is created for both of the classes: FullTimeStaffHire and
PartTimeStaffHire
Display method is called.
Object is reinspected.

Expected result Creation of an object followed by assignation of values


Actual outcome Expected result was obtained
Final result Test was successful

Table 7: Table featuring Test 4

Figure 5: Figure featuring the displayed values of FullTimeStaffHire class

24
Nitesh Poudel
CS4001NI Programming

Figure 6: Figure featuring the displayed values of PartTimeStaffHire class

6. Error Detection

25
Nitesh Poudel
CS4001NI Programming

Error Detection refers to the detection of unexpected error which


resists the anticipated outcome of the following code. There are three
types of errors in Java dubbed as:

I. Syntax Error
II. Runtime Error
III. Logic Error

I. Syntax Error
Syntax Error refers to an error detected by the
compiler that issues a warning if the source code formatting of
the program goes against the Java syntax. For example,
Parenthesis [()] is required to close the parameters, if a
programmer forgets to put the Parenthesis, then Syntax error is
shown by the compiler.

Figure 7: Figure featuring the Syntax Error

In order to fix the error, following measures is taken.

26
Nitesh Poudel
CS4001NI Programming

Figure 8: Figure featuring correction of Syntax Error

II. Runtime Error


Runtime Error is caused when value of one sort of
datatype is placed in other datatype. This sort of error is found
during the debugging phase in error detection. For example:
placing a String value in int datatype.

Figure 9: Figure featuring the Runtime Error

Runtime error could be fixed by taking following measures.

27
Nitesh Poudel
CS4001NI Programming

Figure 10: Figure featuring correction of Runtime Error

III. Logical Error


Logical Error in java refers to the core error in the
sourcecode which is extremely difficult to find. This sort of error
is not objected by the constructor and the code runs as how it is
written but it doesn’t provide expected output. For e.g.:
Assigning wrong value to a certain attribute.

Figure 11: Figure featuring the Logical Error

28
Nitesh Poudel
CS4001NI Programming

Figure 12: Figure featuring the Logical Error followed while creating object

Figure 13: Figure featuring the Logical Error followed while inspecting the object

29
Nitesh Poudel
CS4001NI Programming

Figure 14: Figure featuring the correction of Logical Error

30
Nitesh Poudel
CS4001NI Programming

7. Conclusion

The coursework provides the detailed elaboration on the source


code written for the coursework and different tests that we were
asked to perform and meaning behind error detection and its type.

This coursework helped me know how accessor methods as


well as other methods are used, how constructors are created, how
instance classes are tested and inspected, how objects are created
and so on. This coursework was possible from research done by
looking through different books, websites and consulting teacher. The
class diagram was possible through the use of online chart making
website named [Link]. The tables are created with the use of create
table in MS Word. The screenshots were taken from the compiler we
are assigned to use called BlueJ.

To sum up, this coursework gave me in hand experience on


creating a useable program and taught me how java could be used to
create a useful tool for an organization.

31
Nitesh Poudel
CS4001NI Programming

8. Appendix

class StaffHire{

int vacancyNumber;

String designation;

String jobType;

//staffHire with three attributes are defined

public StaffHire(int vacancyNumber, String designation, String jobType) {

[Link] = vacancyNumber;

[Link] = designation;

[Link] = jobType;

32
Nitesh Poudel
CS4001NI Programming

//three attributes are initialised and their values are assigned

public int getVacancyNumber() {

return vacancyNumber;

public void setVacancyNumber(int vacancyNumber) {

[Link] = vacancyNumber;

public String getDesignation() {

return designation;

public void setDesignation(String designation) {

33
Nitesh Poudel
CS4001NI Programming

[Link] = designation;

public String getJobType() {

return jobType;

public void setJobType(String jobType) {

[Link] = jobType;

// corresponding accessor methods are created

public void displayStaffHire(){

34
Nitesh Poudel
CS4001NI Programming

[Link]("Vacancy Number: "+vacancyNumber);

[Link]("Designation: "+ designation);

[Link]("Job Type: "+jobType);

// display method is created

// new class FullTimeStaffHire which extends to StaffHire is created

class FullTimeStaffHire extends StaffHire {

int salary;

int workingHour;

String staffName;

String joiningDate;

35
Nitesh Poudel
CS4001NI Programming

String qualification;

String appointedBy;

boolean hasJoined;

// seven attributes are defined

public FullTimeStaffHire(int vacancyNumber, String designation, String jobType,


int salary, int workingHour) {

super(vacancyNumber, designation, jobType);

[Link] = salary;

[Link] = workingHour;

staffName="";

joiningDate = "";

36
Nitesh Poudel
CS4001NI Programming

qualification = "";

appointedBy = "";

hasJoined = false;

/* constructor that accepts five parameters are created followed by assigning the
values

to corresponding parameters*/

public int getSalary() {

return salary;

public void setSalary(int salary) {

[Link] = salary;

37
Nitesh Poudel
CS4001NI Programming

public int getWorkingHour() {

return workingHour;

public void setWorkingHour(int workingHour) {

[Link] = workingHour;

public String getStaffName() {

return staffName;

38
Nitesh Poudel
CS4001NI Programming

public void setStaffName(String staffName) {

[Link] = staffName;

public String getJoiningDate() {

return joiningDate;

public void setJoiningDate(String joiningDate) {

[Link] = joiningDate;

public String getQualification() {

39
Nitesh Poudel
CS4001NI Programming

return qualification;

public void setQualification(String qualification) {

[Link] = qualification;

public String getAppointedBy() {

return appointedBy;

public void setAppointedBy(String appointedBy) {

[Link] = appointedBy;

40
Nitesh Poudel
CS4001NI Programming

public boolean isJoined() {

return hasJoined;

public void setJoined(boolean joined) {

[Link] = joined;

// corresponding accessor methods are created

public int salary(int salary){

41
Nitesh Poudel
CS4001NI Programming

if (hasJoined==false){

[Link] = salary;

else{

[Link]("Staff has already joined.");

[Link]();

return salary;

// method that sets the change in salary incase staff have not joined

public int workingHour(int workingHour){

if (hasJoined==false){

[Link] = workingHour;

42
Nitesh Poudel
CS4001NI Programming

}else {

[Link]("Staff has already joined.");

[Link]();

return workingHour;

// method that sets the working hour if staff have not joined

public void hireFullTimeStaff(String staffName, String joiningDate, String


qualification, String appointedBy){

if (hasJoined == false){

[Link] = staffName;

[Link] = joiningDate;

43
Nitesh Poudel
CS4001NI Programming

[Link] = qualification;

[Link] = appointedBy;

[Link] = true;

} else {

[Link]("Staff has already joined.");

[Link]();

// method that asssigns information about staff if he haven't joined

public void displayStaffHire(){

if (hasJoined==true){

[Link]();

44
Nitesh Poudel
CS4001NI Programming

[Link]("Staff Name: " + staffName);

[Link]("Salary: " +salary);

[Link]("Working Hour: " + workingHour);

[Link]("Joining Date: " + joiningDate);

[Link]("Qualification: " + qualification);

[Link]("Appointed By: " + appointedBy);

[Link]();

// method that displays information of staff if he have joined

45
Nitesh Poudel
CS4001NI Programming

// new class PartTimeStaffHire which extends to StaffHire is created

public class PartTimeStaffHire extends StaffHire {

int workingHour;

int wagesPerHour;

String staffName;

String joiningDate;

String qualification;

String appointedBy;

String shifts;

boolean hasJoined;

boolean isTerminated;

// nine attributes are defined

46
Nitesh Poudel
CS4001NI Programming

public PartTimeStaffHire(int vacancyNumber, String designation, String jobType,


int workingHour, int wagesPerHour, String shifts) {

super(vacancyNumber, designation, jobType);

[Link] = workingHour;

[Link] = wagesPerHour;

[Link] = shifts;

staffName="";

joiningDate = "";

qualification = "";

appointedBy = "";

hasJoined = false;

isTerminated = false;

47
Nitesh Poudel
CS4001NI Programming

/* constructor with five parameters are defined followed by asssigning attributes


their

constructor values*/

public int getWorkingHour() {

return workingHour;

public void setWorkingHour(int workingHour) {

[Link] = workingHour;

public int getWagesPerHour() {

return wagesPerHour;

48
Nitesh Poudel
CS4001NI Programming

public void setWagesPerHour(int wagesPerHour) {

[Link] = wagesPerHour;

public String getStaffName() {

return staffName;

public void setStaffName(String staffName) {

[Link] = staffName;

49
Nitesh Poudel
CS4001NI Programming

public String getJoiningDate() {

return joiningDate;

public void setJoiningDate(String joiningDate) {

[Link] = joiningDate;

public String getQualification() {

return qualification;

50
Nitesh Poudel
CS4001NI Programming

public void setQualification(String qualification) {

[Link] = qualification;

public String getAppointedBy() {

return appointedBy;

public void setAppointedBy(String appointedBy) {

[Link] = appointedBy;

public String getShifts() {

51
Nitesh Poudel
CS4001NI Programming

return shifts;

public void setShifts(String shifts) {

[Link] = shifts;

public boolean isHasJoined() {

return hasJoined;

public void setHasJoined(boolean hasJoined) {

[Link] = hasJoined;

52
Nitesh Poudel
CS4001NI Programming

public boolean isTerminated() {

return isTerminated;

public void setTerminated(boolean terminated) {

[Link] = terminated;

// accesor methods are defined

public void setNewShifts(String shifts){

if (hasJoined == false){

53
Nitesh Poudel
CS4001NI Programming

[Link]= shifts;

} else {

[Link]("Staff has already joined.");

[Link]();

// method that defines the shift of a staff who havent joined

public void hirePartTimeStaff(String staffName, String joiningDate, String


qualification, String appointedBy){

if (hasJoined == false){

[Link] = staffName;

[Link] = joiningDate;

54
Nitesh Poudel
CS4001NI Programming

[Link] = qualification;

[Link] = appointedBy;

[Link] = true;

} else {

[Link]("Staff has already joined.");

[Link]();

// method that assigns information about staff who havent joined

public void terminatePartTimeStaff(){

if(isTerminated==true){

[Link]("Staff is terminated");

} else {

55
Nitesh Poudel
CS4001NI Programming

isTerminated = true;

hasJoined = false;

[Link] = "";

[Link] = "";

[Link] = "";

[Link] = "";

// method that assigns information about staff that have not been terminated

public void displayStaffHire(){

if (hasJoined==true){

[Link]();

[Link]("Staff Name: " + staffName);

56
Nitesh Poudel
CS4001NI Programming

[Link]("Wages per hour: " + wagesPerHour);

[Link]("Working Hour: " + workingHour);

[Link]("Joining Date: " + joiningDate);

[Link]("Qualification: " + qualification);

[Link]("Appointed By: " + appointedBy);

[Link]("Income per day: "+ (workingHour*wagesPerHour));

[Link]();

// method that displays information about staff if they have joined

57
Nitesh Poudel
CS4001NI Programming

9. Bibliography

Anon., 2009. StackOverFlow Corporation. [Online] Available at:


[Link]
method#623631 [Accessed 11 January 2020].

Anon., 2018. Dummies Corporation. [Online] Available at:


[Link] [Accessed
11 January 2020].

Anon., 2019. javatpoint Corporation. [Online] Available at:


[Link] [Accessed 11 January 2020].

Anon., 2019. Quora Corporation. [Online] Available at:


[Link] [Accessed 11
January 2020].

Anon., 2019. tutorialspoint Corporation. [Online] Available at: Available at:


[Link] [Accessed 12 January 2020].

Anon., 2019. w3schools Corporation. [Online] Available at:


[Link] [Accessed 11 January 2020].

Liang, Y.D., 2019. Introduction to Java Programming and Data Structures,


Comprehensive Version. Los Angles: Pearson

58
Nitesh Poudel

You might also like