CS4001NI Programming Coursework Overview
CS4001NI Programming Coursework Overview
2019-20 Autumn
Group: L1C12
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:
List of Tables:
1
Nitesh Poudel
CS4001NI Programming
1. Introduction
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
DO
ASSIGN vacancyNumber
ASSIGN designation
ASSIGN jobType
END DO
CALL getVacancyNumber
DO
RETURN vacancyNumber
END DO
DO
ASSIGN vacancyNumber
END DO
‘CALL getDesignation
DO
4
Nitesh Poudel
CS4001NI Programming
RETURN designation
END DO
DO
ASSIGN designation
END DO
‘CALL getJobType
DO
RETURN jobType
END DO
DO
ASSIGN jobType
END DO
DO
PRINT vacancyNumber
PRINT designation
PRINT jobType
END DO
END DO
5
Nitesh Poudel
CS4001NI Programming
DO
DECLARE salary
DECLARE workingHour
DECLARE staffName
DECLARE joiningDate
DECLARE qualification
DECLARE appointedBy
DECLARE hasjoined
DO
ASSIGN salary
ASSIGN workingHour
ASSIGN staffName AS “”
ASSIGN joiningDate AS “”
ASSIGN qualification AS “”
ASSIGN appointedBy AS “”
END DO
CALL getSalary
6
Nitesh Poudel
CS4001NI Programming
DO
RETURN salary
END DO
DO
ASSIGN salary
END DO
CALL getworkingHour
DO
RETURN workingHour
END DO
DO
ASSIGN workingHour
END DO
CALL getStaffName
DO
RETURN staffName
END DO
DO
ASSIGN staffName
7
Nitesh Poudel
CS4001NI Programming
END DO
CALL getJoiningDate
DO
RETURN joiningDate
END DO
DO
ASSIGN joiningDate
END DO
CALL getQualification
DO
RETURN qualification
END DO
DO
ASSIGN qualification
END DO
CALL getAppointedBy
DO
RETURN appointedBy
END DO
8
Nitesh Poudel
CS4001NI Programming
DO
ASSIGN appointedBy
END DO
CALL getIsJoined
DO
RETURN isjoined
END DO
DO
ASSIGN joined
END DO
DO
IF hasJoined is FALSE
ASSIGN salary
END IF
END DO
DO
ELSE
END ELSE
END DO
9
Nitesh Poudel
CS4001NI Programming
DO
IF hasJoined is FALSE
ASSIGN workingHour
END IF
END DO
DO
ELSE
ELSE IF
END DO
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
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
DO
DESCRIBE workingHour
DESCRIBE wagesPerHour
DESCRIBE staffName
DESCRIBE joiningDate
DESCRIBE qualification
DESCRIBE appointedBy
DESCRIBE shifts
DESCRIBE hasJoined
DESCRIBE isTerminated
DO
ASSIGN workingHour
ASSIGN wagesPerHour
ASSIGN shifts
ASSIGN staffName AS “”
ASSIGN joiningDate AS “”
ASSIGN qualification AS “”
ASSIGN appointedBy AS “”
12
Nitesh Poudel
CS4001NI Programming
END DO
CALL getWorkingHour
DO
RETURN workingHour
END DO
DO
ASSIGN workingHour
END DO
CALL getWagesPerHour
DO
RETURN wagesPerHour
END DO
DO
ASSIGN wagesPerHour
END DO
CALL getStaffName
DO
RETURN staffName
13
Nitesh Poudel
CS4001NI Programming
END DO
DO
ASSIGN staffName
END DO
CALL getJoiningDate
DO
RETURN joiningDate
END DO
DO
ASSIGN joiningDate
END DO
CALL getQualification
DO
RETURN qualification
END DO
DO
ASSIGN qualification
END DO
CALL getAppointedBy
14
Nitesh Poudel
CS4001NI Programming
DO
RETURN appointedBy
END DO
DO
ASSIGN appointedBy
END DO
CALL getShifts
DO
RETURN shifts
END DO
DO
ASSIGN shifts
END DO
CALL getIsTerminated
DO
RETURN isTerminated
END DO
DO
ASSIGN isterminated
15
Nitesh Poudel
CS4001NI Programming
END DO
DO
IF joined is FALSE
ASSIGN shifts
END IF
END DO
DO
ELSE
END ELSE
END DO
DO
IF joined is FALSE
ASSIGN staffName
ASSIGN joiningDate
ASSIGN qualification
ASSIGN appointedBy
END IF
END DO
16
Nitesh Poudel
CS4001NI Programming
CALL terminatePartTimeStaff
DO
IF isTerminated is TRUE
END ID
END DO
DO
ELSE
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
END IF
END DO
END DO
END DO
4. Method Description
Method Description
18
Nitesh Poudel
CS4001NI Programming
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
Method Description
getWorkingHour This method is used to return workingHour
getWagesPerHour This method is used to return wagesPerHour
19
Nitesh Poudel
CS4001NI Programming
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
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
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
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.
24
Nitesh Poudel
CS4001NI Programming
6. Error Detection
25
Nitesh Poudel
CS4001NI Programming
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.
26
Nitesh Poudel
CS4001NI Programming
27
Nitesh Poudel
CS4001NI Programming
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
30
Nitesh Poudel
CS4001NI Programming
7. Conclusion
31
Nitesh Poudel
CS4001NI Programming
8. Appendix
class StaffHire{
int vacancyNumber;
String designation;
String jobType;
[Link] = vacancyNumber;
[Link] = designation;
[Link] = jobType;
32
Nitesh Poudel
CS4001NI Programming
return vacancyNumber;
[Link] = vacancyNumber;
return designation;
33
Nitesh Poudel
CS4001NI Programming
[Link] = designation;
return jobType;
[Link] = jobType;
34
Nitesh Poudel
CS4001NI Programming
int salary;
int workingHour;
String staffName;
String joiningDate;
35
Nitesh Poudel
CS4001NI Programming
String qualification;
String appointedBy;
boolean hasJoined;
[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*/
return salary;
[Link] = salary;
37
Nitesh Poudel
CS4001NI Programming
return workingHour;
[Link] = workingHour;
return staffName;
38
Nitesh Poudel
CS4001NI Programming
[Link] = staffName;
return joiningDate;
[Link] = joiningDate;
39
Nitesh Poudel
CS4001NI Programming
return qualification;
[Link] = qualification;
return appointedBy;
[Link] = appointedBy;
40
Nitesh Poudel
CS4001NI Programming
return hasJoined;
[Link] = joined;
41
Nitesh Poudel
CS4001NI Programming
if (hasJoined==false){
[Link] = salary;
else{
[Link]();
return salary;
// method that sets the change in salary incase staff have not joined
if (hasJoined==false){
[Link] = workingHour;
42
Nitesh Poudel
CS4001NI Programming
}else {
[Link]();
return workingHour;
// method that sets the working hour if staff have not joined
if (hasJoined == false){
[Link] = staffName;
[Link] = joiningDate;
43
Nitesh Poudel
CS4001NI Programming
[Link] = qualification;
[Link] = appointedBy;
[Link] = true;
} else {
[Link]();
if (hasJoined==true){
[Link]();
44
Nitesh Poudel
CS4001NI Programming
[Link]();
45
Nitesh Poudel
CS4001NI Programming
int workingHour;
int wagesPerHour;
String staffName;
String joiningDate;
String qualification;
String appointedBy;
String shifts;
boolean hasJoined;
boolean isTerminated;
46
Nitesh Poudel
CS4001NI Programming
[Link] = workingHour;
[Link] = wagesPerHour;
[Link] = shifts;
staffName="";
joiningDate = "";
qualification = "";
appointedBy = "";
hasJoined = false;
isTerminated = false;
47
Nitesh Poudel
CS4001NI Programming
constructor values*/
return workingHour;
[Link] = workingHour;
return wagesPerHour;
48
Nitesh Poudel
CS4001NI Programming
[Link] = wagesPerHour;
return staffName;
[Link] = staffName;
49
Nitesh Poudel
CS4001NI Programming
return joiningDate;
[Link] = joiningDate;
return qualification;
50
Nitesh Poudel
CS4001NI Programming
[Link] = qualification;
return appointedBy;
[Link] = appointedBy;
51
Nitesh Poudel
CS4001NI Programming
return shifts;
[Link] = shifts;
return hasJoined;
[Link] = hasJoined;
52
Nitesh Poudel
CS4001NI Programming
return isTerminated;
[Link] = terminated;
if (hasJoined == false){
53
Nitesh Poudel
CS4001NI Programming
[Link]= shifts;
} else {
[Link]();
if (hasJoined == false){
[Link] = staffName;
[Link] = joiningDate;
54
Nitesh Poudel
CS4001NI Programming
[Link] = qualification;
[Link] = appointedBy;
[Link] = true;
} else {
[Link]();
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
if (hasJoined==true){
[Link]();
56
Nitesh Poudel
CS4001NI Programming
[Link]();
57
Nitesh Poudel
CS4001NI Programming
9. Bibliography
58
Nitesh Poudel