How would you define an accessor and mutator (getter and setter) method for the Behavior class's timeToComplete instance variable? Choose one of the following from the above choices (A, B, C or D within the code). // A public int getTimeToComplete() { return this.behaviorList; } public void setTimeToComplete(int timeToComplete) { this.timeToComplete = timeToComplete; } // B public int getTimeToComplete() { return this.behaviorList; } public void setTimeToComplete(int timeToComplete) { timeToComplete = timeToComplete; } // C public void getTimeToComplete(int timeToComplete) { return this.behaviorList; } public int setTimeToComplete(int timeToComplete) { return this.timeToComplete = timeToComplete; } // D public int getTimeToComplete() { return this.behaviorList.getList(); } public void setTimeToComplete(double timeToComplete) { this.timeToComplete = timeToComplete; }
How would you define an accessor and mutator (getter and setter) method for the Behavior class's timeToComplete instance variable? Choose one of the following from the above choices (A, B, C or D within the code).
// A
public int getTimeToComplete() {
return this.behaviorList;
}
public void setTimeToComplete(int timeToComplete) {
this.timeToComplete = timeToComplete;
}
// B
public int getTimeToComplete() {
return this.behaviorList;
}
public void setTimeToComplete(int timeToComplete) {
timeToComplete = timeToComplete;
}
// C
public void getTimeToComplete(int timeToComplete) {
return this.behaviorList;
}
public int setTimeToComplete(int timeToComplete) {
return this.timeToComplete = timeToComplete;
}
// D
public int getTimeToComplete() {
return this.behaviorList.getList();
}
public void setTimeToComplete(double timeToComplete) {
this.timeToComplete = timeToComplete;
}
Step by step
Solved in 2 steps