Question: For the class Employee example provided in tutorial 3 . 1 . 7 , what code segment could be added to keep track of the

For the class Employee example provided in tutorial 3.1.7, what code segment could be added to keep track of the number of job titles ever held by an employee in a variable called numJobTitles?
public String setJobtitle(String title){
if (title.length()>0){
this.jobtitle = title;
this.numJobTitles +=1;
}
}
public int getNumJobtitles(){
return this.numJobTitles;
}
public void setJobtitle(title){
if (title.length()>0){
this.jobtitle = title;
this.numJobTitles +=1;
}
}
public int getNumJobtitles(numJobTitles){
return this.numJobTitles;
}
public void setJobtitle(String title){
if (title.length()>0){
this.jobtitle = title;
this.numJobTitles +=1;
}
}
public void getNumJobtitles(){
return this.numJobTitles;
}
public void setJobtitle(String title){
if (title.length()>0){
this.jobtitle = title;
this.numJobTitles +=1;
}
}
public int getNumJobtitles(){
return this.numJobTitles;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!