Sie sind auf Seite 1von 62

Table of Contents

1. Introduction .................................................................................................................. 1

2. Class Diagram .............................................................................................................. 1

2.1 Developer (parent class) ......................................................................................... 2

2.2 Senior Developer (Child class) ............................................................................... 2

2.3 Junior Developer (Child class) ................................................................................ 3

Relation of inheritance ..................................................................................................... 5

3. Pseudo code ................................................................................................................ 7

3.1 Developer Class ..................................................................................................... 7

3.2 Senior Developer .................................................................................................... 9

3.3 Junior Developer................................................................................................... 13

4. Methods Description .................................................................................................. 17

4.1 Developer (Parent Class) ..................................................................................... 17

4.2 SeniorDeveloper (Child Class).............................................................................. 18

4.3 JuniorDeveloper (Child Class) .............................................................................. 20

5. Testing ....................................................................................................................... 22

5.1 Test 1.................................................................................................................... 22

5.2 Test 2.................................................................................................................... 26

5.3 Test 3.................................................................................................................... 30

5.4 Test 4.................................................................................................................... 34


6. Errors ......................................................................................................................... 41

6.1 Runtime error ........................................................................................................ 41

6.2 Semantic error ...................................................................................................... 42

6.3 Syntax error .......................................................................................................... 43

7. Conclusion ................................................................................................................. 44

Appendix ........................................................................................................................ 45

Developer class .......................................................................................................... 45

Senior Developer (Child class) ................................................................................... 48

Junior Developer (Sub- Class) .................................................................................... 54


Table of Figures

Figure 1 Creating object of senior developer ................................................................. 22


Figure 2 Inspect object of senior developer class ......................................................... 22
Figure 3 hireDeveloper method is called ....................................................................... 23
Figure 4 Re-inspecting object of senior developer class ............................................... 23
Figure 5 Creating object of senior developer class ....................................................... 25
Figure 6 Inspecting object of senior developer class ..................................................... 25
Figure 7 The terminateDeveloper method is called ....................................................... 26
Figure 8 Re-inspecting object of senior developer class ............................................... 26
Figure 9 creating object of junior developer .................................................................. 28
Figure 10 Inspecting object of junior developer class .................................................... 28
Figure 11 appointDeveloper method is called ............................................................... 29
Figure 12 Re-inspecting object of junior developer class .............................................. 29
Figure 13 Creating object of junior developer class ...................................................... 31
Figure 14 appointDeveloper method is called ............................................................... 31
Figure 15 Displaying the output of junior developer class ............................................. 32
Figure 16 Creating object of senior developer class ..................................................... 34
Figure 17 appointDeveloper method is called ............................................................... 34
Figure 18 Displaying the output of senior developer ..................................................... 35
Figure 19 Detection of runtime error.............................................................................. 36
Figure 20 Correction of runtime error using inverted comma ........................................ 36
Figure 21 Detection of semantic error ........................................................................... 37
Figure 22 Correction of semantic error writing variable’ interviewer name’ in camel case
...................................................................................................................................... 37
Figure 23 Detection of syntax error ............................................................................... 38
Figure 24 Correction of syntax error by using semi colon ............................................. 38

Table of tables

Table 1: Class Diagram of Developer Class .................................................................... 2


Table 2: Class Diagram of Senior Developer Class ........................................................ 3
Table 3: Class Diagram of Junior Developer ................................................................... 4
CS4001NT programming

1. Introduction

The aim of this project is to develop the software based on java programming for the
institution which hire the developer for the particular institution. In this project, a class to
represent a Developer together with two sub classes to represent Senior and a Junior
developer has created respectively.

This software is basically used in organization which helps the institution to hire the
developer which displays the detailed information of the developer. This system is a
computerized system which reduces the loss of records files of hired developers which
basically happens on non-computerized system. The software mainly focuses on record
the information of developer like interviewer name, developer name, advance salary,
working hours, and contract period.

2. Class Diagram

1
CS4001NT programming

2.1 Developer (parent class)

Table 1: Class Diagram of Developer Class


Developer Class
- platform: String

- interviewerName: String

- developerName: String

- workingHours: int

+ getplatform(): String

+ getInterviewerName(): String

+ getDeveloperName(): String

+ getWorkingHours(): int

+ setDeveloperName(developerName: String): void

+ display(): void

2.2 Senior Developer (Child class)

Table 2: Class Diagram of Senior Developer Class

2
CS4001NT programming

Senior Developer

- salary(): int
- joiningDate(): String
- staffRoomNumber(): String
- contractPeroid(): int
- advanceSalary(): double
- appointed(): boolean
- terminated(): boolean

+ getSalary (): int


+ getJoiningDate (): String
+ getStaffRoomNumber (): String
+ getContractPeriod (): int
+ getAdvanceSalary(): double
+ getAppointed (): boolean
+ getTerminated (): boolean
+ setSalary (salary: int): void
+ setContractPeriod (contractPeriod:int): void
+ hireDeveloper(developerName: String, joiningDate: String, advanceSalary: double,
staffRoomNumber: String): void
+ terminateDeveloper(developerName: String): void
+ developerDetails(): void
+ display(): void

2.3 Junior Developer (Child class)

Table 3: Class Diagram of Junior Developer

3
CS4001NT programming

JuniorDeveloper (Child Class)

- salary(): int
- appointedDate(): String
- evaluationPeriod(): String
- terminationDate(): String
- specialization(): String
- appointedBy(): String
- joined(): boolean

+ getSalary (): int


+ getAppointedDate(): int
+ getEvaluationPeriod(): String
+ getTerminationDate(): String
+ getSpecialization(): String
+ getAppointedBy(): String
+ getJoined(): boolean
+ setSalary(salary: int): void
+ appointDeveloper(developerName: String, appointedDate: String, terminationDate: String
specialization: String): void
+ display(): void

4
CS4001NT programming

Relation of inheritance

5
CS4001NT programming

6
CS4001NT programming

3. Pseudo code

3.1 Developer Class

DEFINE setDeveloperName(ACCEPT the value developerName String as parameter)


DO
INITIALIZE the value of ‘developerName’ received as argument to the instance
variable ‘developerName’ END DO

DEFINE return type ‘String’ getPlatform()


DO
EXTRACT the value from instance variable Platform and
RETURN the value of Platform
END DO

DEFINE return type ‘String’ getInterviewerName()


DO
EXTRACT the value from instance variable interviewerName and
RETURN the value of interviewerName
END DO

DEFINE return type ‘String’ getDeveloperName()


DO
EXTRACT the value from instance variable developerName and
RETURN the value of developerName
END DO
DEFINE return type ‘integer’ getWorkingHours()
DO
EXTRACT the value from instance variable workingHours and
RETURN the value of workingHours
7
CS4001NT programming

END DO

DEFINE display()
DO
DISPLAY platform
DISPLAY interviewerName
DISPLAY workingHours
IF developerName is not equal to “ ”
DO
DISPLAY developerName
END IF
END DO

8
CS4001NT programming

3.2 Senior Developer

DEFINE return type ‘integer’ getSalary() DO


EXTRACT the value from instance variable ‘salary’ and
RETURN the value of ‘salary’
END DO

DEFINE return type ‘String’ getJoiningDate()


DO
EXTRACT the value from instance variable ‘joiningDate’ and
RETURN the value of ‘joiningDate’
END DO

DEFINE return type ‘String’ getStaffRoomNumber()


DO
EXTRACT the value from instance variable ’staffroomnumber’ and
RETURN the value of ‘staffroomnumber’
END DO

DEFINE return type ‘integer’ getContractPeriod()


DO
EXTRACT the value from instance variable ‘contractperiod’ and
RETURN the value of ‘contractperiod’
END DO

DEFINE return type ‘double’ getAdvanceSalary() DO


EXTRACT the value from instance variable ‘advancesalary’ and
RETURN the value of ‘advancesalary’
END DO

9
CS4001NT programming

DEFINE return type ‘boolean’ getAppointed() DO


EXTRACT the value from instance variable ‘appointed’ and
RETURN the value of ‘appointed’
END DO

DEFINE return type ‘boolean’ getterminated() DO


EXTRACT the value from instance variable ‘terminated’ and
RETURN the value of ‘terminated’
END DO

DEFINE setSalary(ACCEPT the value salary ‘integer’ as parameter)


DO
INITIALIZE the value to the instance variable ‘salary’
END DO

DEFINE setContractPeriod(ACCEPT the value contractPeriod ‘integer’ as parameter) DO


INITIALLIZE the value to the instance variable ‘contractperiod’
END DO

DEFINE hireDeveloper(ACCEPT the values developerName ‘String’, joiningDate ‘String’,


advanceSalary ‘double’, staffRoomNumber ‘String’)
DO
IF appointed is equal to ‘TRUE’
DO

10
CS4001NT programming

DISPLAY sorry the developer has already been appointed with staff
room number END DO

ELSE
DO
CALL is made to super class to INITIALLIZE
INITIALLIZE this.staffRoomNumber to ‘String’ staffRoomNumber
INITIALIZE this.joiningDate to ‘String’ joiningDate
INITIALLIZE this.advanceSalary to ‘double’ advanceSalary
INITIALLIZE appointed to ‘boolean’ TRUE
INITIALLIZE terminated to ‘boolean’ FALSE
END DO
END IF
END DO

DEFINE terminateDeveloper(ACCEPT the values developerName ‘String’)


DO
IF terminated is equal to ‘FALSE’
DO

INITIALIZE joiningDate as (“ ”) empty ‘String’


INITIALLIZE appointed is equal to ‘FALSE’
INITIALLIZE terminated is equal to ‘TRUE’
END DO
ELSE
DO
DISPLAY the developer contract is terminated
END DO
END IF
END DO

11
CS4001NT programming

DEFINE developerDetails ()
DO
DISPLAY platform
DISPLAY Interviewer Name
DISPLAY Salary
END DO

DEFINE display()
DO
CALL display method from parent class
DO
IF appointed is equal to ‘TRUE’
INITIALIZE terminated is equal to ‘FALSE’
DO
DISPLAY joining date
DISPLAY Advance Salary
DISPLAY Developer Name
END DO
END IF
END DO
END DO

12
CS4001NT programming

3.3 Junior Developer

DEFINE JuniorDeveloper(String platform, String interviewerName, int workingHour,


double salary, String appointedBy, String terminationDate)
DO
CALL (platform ‘String’, interviewerName ‘String’, workingHour ‘integer’) from
parent class
INITIALIZE this.salary to ‘String’ salary
INITIALIZE this.appointedBy to ‘String’ appointedBy
INITIALIZE this.terminationDate to ‘String’ terminnationDate
INITIALIZE appointedDate as empty string
INITIALIZE evaluationPeriod as empty string
INITIALIZE specialization as empty string
INITIALIZE joined as ‘Boolean’ FALSE
END DO
DEFINE setSalary (ACCEPT the value newSalary ‘integer’ as parameter) DO
IF joined is equal to ‘FALSE’
ASSIGN salary to newSalary
END IF
ELSE
DISPLAY sorry there is no change in salary developer has already been
appointed
END ELSE

13
CS4001NT programming

END DO

DEFINE return type ‘integer ’getSalary()


DO
EXTRACT the value from instance variable ‘salary’ and
RETURN the value of ‘salary’
END DO

DEFINE return type ‘String’ getAppointedDate()


DO
EXTRACT the value from instance variable ‘appointedDate’ and
RETURN the value of ‘ appointedDate’
END DO

DEFINE return type ‘String’ getEvaluationPeriod()


DO
EXTRACT the value from instance variable ‘evaluationPeriod’ and
RETURN the value of ‘ evaluationPeriod’
END DO

DEFINE return type ‘String’ getSpecialization()


DO
EXTRACT the value from instance variable ‘specialization’ and
RETURN the value of ‘specialization’
END DO

14
CS4001NT programming

DEFINE return type ‘String’ getAppointedBy() DO


EXTRACT the value from instance variable ‘appointedBy’ and
RETURN the value of ‘ appointedBy’
END DO

DEFINE return type ‘boolean’ getJoined() DO


EXTRACT the value from instance variable ‘joined’ and
RETURN the value of ‘ joined’
END DO

DEFINE appointDeveloper(ACCEPT the values of ‘developerName’, ‘ appointedDate’,


‘terminationDate’, ‘specialization’ string as parameters)
DO
INITIALIZE the values received as argument to the instance variables
IF joined is equal to ‘FALSE’
DO
CALL set.DeveloperName from parent class
INITIALIZE this.appointedDate to ‘String’appointedDate
INITIALIZE this.terminationDate to ‘String’terminationDate
INITIALIZE this.specialization to ‘String’ specialization
INITIALIZE joined to ‘boolean’ TRUE
END DO
ELSE
DISPLAY developer has already been appointed with appointed date
END DO

15
CS4001NT programming

DEFINE display()
DO
CALL super.display() from parent class
IF joined is equal to ‘TRUE’
DO
DISPLAY Appointed date is
DISPLAY Developer
DISPLAY Evaluation period is
DISPLAY Termination date is
DISPLAY Developer salary
DISPLAY Developer is specialized in
DISPLAY Developer is appointed by
END DO
END IF
END DO

16
CS4001NT programming

4. Methods Description
4.1 Developer (Parent Class)

• getPlatform
This method is used to extract value from the instance variable ‘platform’ and return the
value.

• getInterviewerName()
This method is used to extract the value from instance variable
‘interviewerName’ and return the value.

• getDeveloperName()
This method is used to extract the value from instance variable ‘developerName’ and
return the value.

• getWorkinngHours()
This method is used to extract the value from the instance variable

17
CS4001NT programming

‘workinngHours’ and return the value.

• Display()
This method is used to display the

4.2 SeniorDeveloper (Child Class)

• getSalary()
This method is used to extract the value from the instance variable ‘salary’ and return
the value

• getJoiningDate()
This method is used to extract the value from the instance variable ‘joiningDate’ and
return the value.

• getStaffRoomNumber()
This method is used to extract the value from the instance variable
‘staffRoomNumber’ and return the value.

• getContractPeriod()

18
CS4001NT programming

This method is used to extract the value from the instance variable ‘contractPeriod’
and return the value.

• getAppointed()
This method is used to extract the value from the instance variable ‘appointed’ and
return the value.

• getTerminated()
This method is used to extract the value from the instance variable ‘terminated’ and
return the value.

• getAdvanceSalary()
This method is used to extract the value from the instance variable ‘advanceSalary’
and return the value.

• setSalary()
This is the method to set the salary to the instance variable ‘salary’

• setContractPeriod()
This is the method to set the contract period to the instance variable
‘contractPeriod’

• hireDeveloper()
This is the method to set the value on parameter String newSalary, String joiningDate,
double advanceSalary, String staffRoomNumber.

• terminateDeveloper()
This is the method to accept the value on parameter as String developerName.

• developerDetails(): void

19
CS4001NT programming

This is the method which display the details of developer.

• display(): void
This is the method to display the information about joiningDate, advanceSalary, and
developer.

4.3 JuniorDeveloper (Child Class)

getSalary()
This is the method to extract the value from the instance variable ‘salary’ and return the value.

getAppointedDate()
This method is used to extract the value from the instance variable ‘appointedDate’ and return
the value.

getEvaluationPeriod()

20
CS4001NT programming

This method is used to extract the value from the instance variable ‘evaluationPeriod’ and
return the value.

getSpecialization()
This is the method to extract the value from the instance variable ‘specialization’ and return the
value.

getAppointedBy()
This is the method to extract the value from the instance variable ‘appointedBy’ and return
the value.

getJoined()
This method is used to extract the value from the instance variable ‘joined’ and return
the value. getterminationDate()
This method is used to extract the value from the instance variable ‘terminationDate’ and

return the value. setSalary(): void

This method is used to set the salary to the instance variable ‘salary’ appointDeveloper(): void
This is the method to appoint the developer with developername, appointedDate,
terminationDate, specialization.

display()
This is the method to display the details of junior developer.

21
CS4001NT programming

5. Testing

5.1 Test 1

To inspect object of SeniorDeveloper class, and appoint a developer


Objective to particular platform and re-inspect it.

22
CS4001NT programming

Action Constructor of SeniorDeveloper Class is called with following


arguments:
platform = “ANDROID”
interviewerName = “Sulav Budathoki”
workingHours =12 salary =1499
contractPeroid =3

Inspected objects of SeniorDeveloper Class

hireDeveloper method is called with following below arguments:

developerName = “Ankit Adhikari”


joiningDate = “1/01/2019”
advanceSalary = 0.0
staffRoomNumber = “T-03”

Re-inspected objects of SeniorDeveloper Class

Expected Object will be created with given arguments.


Result
Actual Result Object has been created.
Conclusion Test Successful.

23
CS4001NT programming

Figure 1 Creating object of senior developer

24
CS4001NT programming

Figure 2 Inspect object of senior developer class

Figure 3 hireDeveloper method is called

25
CS4001NT programming

Figure 4 Re-inspecting object of senior developer class

5.2 Test 2

To inspect object of SeniorDeveloper class, and appoint a developer


Objective to particular platform and re-inspect it.

26
CS4001NT programming

Action Constructor of SeniorDeveloper Class is called with following


arguments:
platform = “ANDROID”
interviewerName = “Sulav
Budathoki” workingHours =12 salary
=1499 contractPeroid =3

Changed the terminated status and inspect it.

terminateDeveloper method is called with following parameters:

developerName = “Ankit Adhikari”


Re-inspected objects of SeniorDeveloper Class

Expected Terminated status should be change


Result
Actual Result Object has been created and terminated status has been changed.
Conclusion Test Successful.

27
CS4001NT programming

Figure 5 Creating object of senior developer class

28
CS4001NT programming

Figure 6 Inspecting object of senior developer class

Figure 7 The terminateDeveloper method is called

29
CS4001NT programming

Figure 8 Re-inspecting object of senior developer class

5.3 Test 3

Objective To inspect an object of JuniorDeveloper class and appoint


developer and re-inspect it.

30
CS4001NT programming

Action Constructor of JuniorDeveloper Class is called with following


parameters.

platform = “IOS”
interviewerName = “Ankit”
workingHours = 12 salary =
1399 appointedBy = “Nikhil S”
terminationDate = “01/04/2018”

Inspected object of JuniorDeveloper Class appointDeveloper


method is called with following arguments

developerName = “Ankit A” appointedDate


= “01/07/2018” terminationDate =
“01/04/2018” specialization = “Web
Designing”

Object of JuniorDeveloper class re-inspected.

Expected Value Object will be created with required arguments.


Actual Result Object has been created.
Conclusion Test Successful

31
CS4001NT programming

Figure 9 creating object of junior developer

32
CS4001NT programming

Figure 10 Inspecting object of junior developer class

Figure 11 appointDeveloper method is called

33
CS4001NT programming

Figure 12 Re-inspecting object of junior developer class

5.4 Test 4

Objective To inspect an object of JuniorDeveloper class and display


Action Inspect JuniorDeveloper Class and display the output of
following parameters.

platform = “IOS”
interviewerName =
“Ankit” workingHours =
12 salary = 1399
appointedBy = “Nikhil S” terminationDate
= “01/04/2018”
Inspected object of JuniorDeveloper Class appointDeveloper
method is called with following arguments to display the
output.

developerName = “Ankit A” appointedDate


= “01/07/2018” terminationDate =
“01/04/2018” specialization = “Web
Designing”

Expected Value The output should be displayed.

34
CS4001NT programming

Actual Result The actual output was displayed


Conclusion Test Successful

Figure 13 Creating object of junior developer class

35
CS4001NT programming

Figure 14 appointDeveloper method is called

36
CS4001NT programming

Figure 15 Displaying the output of junior developer class

37
CS4001NT programming

To inspect object of SeniorDeveloper class, and display


Objective
Action Inspect SeniorDeveloper Class and display the output of following
arguments:
platform = “ANDROID”
interviewerName = “Sulav
Budathoki” workingHours =12 salary
=1499 contractPeroid =3

Inspected objects of SeniorDeveloper Class

hireDeveloper method is called with following below arguments to


display the output

developerName = “Ankit Adhikari”


joiningDate = “1/01/2019”
advanceSalary = 0.0
staffRoomNumber = “T-03”

Expected The output should be displayed


Result
Actual Result The actual output was displayed
Conclusion Test Successful.

38
CS4001NT programming

Figure 16 Creating object of senior developer class

Figure 17 appointDeveloper method is called

39
CS4001NT programming

Figure 18 Displaying the output of senior developer

40
CS4001NT programming

6. Errors

6.1 Runtime error

Figure 19 Detection of runtime error

41
CS4001NT programming

Figure 20 Correction of runtime error using inverted comma

6.2 Semantic error

Figure 21 Detection of semantic error

42
CS4001NT programming

Figure 22 Correction of semantic error writing variable’ interviewer name’ in camel case

6.3 Syntax error

Figure 23 Detection of syntax error

43
CS4001NT programming

Figure 24 Correction of syntax error by using semi colon

7. Conclusion

The module of this project is all about developing a software based on java programming
language. Java is an object oriented and multi-platform computer programming language
which convert human readable language into machine language. This project is done by
using Bluej. Bluej is an integrated development environment for java basically designed
for beginners.

This estimation is about fabricating software based on java programming for the
institution. In this project, a file is created in Bluej representing a Developer class together
with two sub classes to represent Senior and a Junior developer respectively.

44
CS4001NT programming

Thinking back to my primary schooling I see myself as an excited to be a programmer.


Before starting the module I was so excited to fabricate this software but then I found
many difficulties regarding the coursework. To deal with the module I have taken
references from library and module teacher which helped me out providing knowledge
enoughly. However, this project encourage me to know more about java programming
language which will obviously help me to develop more software sonner or later.

Appendix
Developer class
/**
* This is first coursework of programming.
* Here, we have developer class which have two sub classes Senior and Junior Developer
* Code done by Ankit Adhikari
*/
public class Developer
{
/**

45
CS4001NT programming

* Now we are making accessor method for each attributes


*/
private String platform;
public String getPlatform()
{
return platform;
}

private String interviewerName;


public String getInterviewerName()
{
return interviewerName;
}

private String developerName;


public String getDeveloperName()
{
return developerName;
}

private int workingHours;


public int getWorkingHours()
{
return workingHours;
}

/**

46
CS4001NT programming

* Here, we are initiallizing the attributes in the constructor assigning the value of constructor's
parameters
*/
public Developer(String platform, String interviewerName, int workingHours)
{
this.platform= platform; this.interviewerName=
interviewerName; this.workingHours= workingHours;
developerName= ""; // set developer name as empty string
}

/**
* Here, we are defining method to set the developer name
*/
public void setDeveloperName(String developerName)
{
this.developerName= developerName;
}

/**
* Now, we are making display method and displaying the output
*/
public void display()
{
System.out.println("Platform:" + platform);
System.out.println("Interviewer:" +interviewerName);
System.out.println("Workinng Hours:" +workingHours); if(developerName!=(""))
System.out.println("Developer Name:" +getDeveloperName());
}
}

47
CS4001NT programming

Senior Developer (Child class)

public class SeniorDeveloper extends Developer


{

48
CS4001NT programming

/**
* Now we are making accessor method for each attributes
*/
private int salary;
public int getSalary()
{
return salary;
}

private String joiningDate;


public String getJoiningDate()
{
return joiningDate;
}

private String staffRoomNumber;


public String getStaffRoomNumber()
{
return staffRoomNumber;
}

private int contractPeriod;


public int getContractPeriod()
{
return contractPeriod;
}

private double advanceSalary;


public double getAdvanceSalary()
{

49
CS4001NT programming

return advanceSalary;
}

private boolean appointed;


public boolean getAppointed()
{
return appointed;
}

private boolean terminated;


public boolean getTerminated()
{
return terminated;
}

/**
* initiallizing the attributes in the constructor assigning the value of constructor's parameters
*/
public SeniorDeveloper (String platform, String interviewerName, int workingHours, int
salary, int contractPeriod)
{
super (platform,interviewerName,workingHours); // call is made to parent class
this.salary= salary; this.contractPeriod= contractPeriod;

joiningDate= ""; // assign joining date as empty string


staffRoomNumber= ""; // assign staff room number as empty string

50
CS4001NT programming

advanceSalary= 0; appointed= false; // assign the appointed status as


false terminated= false; // assign the terminated status as false

public void setSalary(int salary) // This is a method to set the salary


{
this.salary= salary;
}

public void setContractPeriod(int contractPeriod) // This is a method to set contract period


{
this.contractPeriod= contractPeriod;
}

public void hireDeveloper(String developerName, String joiningDate, double advanceSalary,


String staffRoomNumber)
{
if(appointed==true)
{
System.out.println("Sorry developer has already been apponted."+ "room
number:"+staffRoomNumber);
}
else
{
super.setDeveloperName (developerName); // call is made to parent class
// Now, we are updating staff room number, joining date and advance salary
this.staffRoomNumber= staffRoomNumber; this.joiningDate= joiningDate;

51
CS4001NT programming

this.advanceSalary= advanceSalary; appointed=


true; // assign appointed status as true terminated=
false; // assign terminated status as false
}
}

public void terminateDeveloper(String developerName)


{
if(terminated==false) //
{
super.setDeveloperName(""); // call is made to parent class to assign set
devloper name as empty string joiningDate= ""; // assign joining date as empty
string appointed= false; // assign appointed status to false terminated=
true; // assign terminated status to true
}
else
{
System.out.println("The developer contract is terminated");
}
}
// This is a method to display developer details
public void developerDetails()
{
System.out.println("platform:" +super.getPlatform());
System.out.println("Interviewer Name:" +super.getInterviewerName());
System.out.println("Salary:" +salary);

52
CS4001NT programming

public void display()


{
super.display(); // call is made to parent class
if(appointed== true)
{
terminated= false; // assign terminated status to false
System.out.println("Joining Date:" +joiningDate);
System.out.println("Advance Salary:" +advanceSalary);
System.out.println("Developer Name:" +getDeveloperName());
}
}

53
CS4001NT programming

Junior Developer (Sub- Class)

public class JuniorDeveloper extends Developer


{
/**
* initiallizing the attributes in the constructor assigning the value of constructor's parameters
*/
public JuniorDeveloper( String platform, String interviewerName, int workingHours ,int salary,
String appointedBy,String terminationDate)
{
super(platform,interviewerName,workingHours); // call is made to respective
parameters of parent class this.salary=salary; this.appointedBy=appointedBy;
this.terminationDate=terminationDate; appointedDate=""; evaluationPeriod="";
specialization=""; joined=false;
}

public void setSalary(int newsalary)


{
this.salary=newsalary;
if(joined==false)
{
this.salary=newsalary;

54
CS4001NT programming

}
else {

System.out.println("Developer is already appointed so there is no change in salary.");


}
}
/**
* creating accessor method for each attributes
*/
private String terminationDate;
public String getterminationDate()
{
return terminationDate;
}

private int salary;


public int getSalary()
{ return
salary;
}

private String appointedDate;


public String getAppointedDate()
{
return appointedDate;
}

private String evaluationPeriod;


public String getEvaluationPeriod()
{
return evaluationPeriod;

55
CS4001NT programming

private String specialization;


public String getSpecialization()
{
return specialization;
}

private String appointedBy;


public String getAppointedBy()
{
return appointedBy;
}

private boolean joined;


public boolean getJoined()
{ return
joined;
}

/**
* initiallizing the attributes in the constructor assigning the value of constructor's parameters
*/

public void appointDeveloper(String developerName,String appointedDate,String


terminationDate,String specialization)

56
CS4001NT programming

{
if(joined==false)
{
super.setDeveloperName(developerName); // call is made to parent class
// updating appointed date, termination date and specialization
this.appointedDate=appointedDate;
this.terminationDate=terminationDate;
this.specialization=specialization; joined=true; // assign joined
status to true
}
else
{
System.out.println("developer is already appointed and date is"+appointedDate);

}
}

public void display()


{
super.display(); // call is made to display method of parent class
if(joined==true)
{
System.out.println("Appointed date is: "+appointedDate);
System.out.println("Developer :"+super.getDeveloperName());
System.out.println("Evaluation period is:"+evaluationPeriod);
System.out.println("Termination date is:"+terminationDate);
System.out.println("Developer salary:"+salary);
System.out.println("Developer is specialized in:"+specialization);
System.out.println("Developer is appointed by:"+appointedBy);

57
CS4001NT programming

}
}
}

58

Das könnte Ihnen auch gefallen