Which of the above choices (A, B, C or D) creates an Behavior class with instance variables that store the following state: Behavior name Body part Time to complete the behavior Total time given for this behavior
Which of the above choices (A, B, C or D) creates an Behavior class with instance variables that store the following state:
- Behavior name
- Body part
- Time to complete the behavior
- Total time given for this behavior
// A
public class Behavior {
private String behaviorName;
private String bodyPart;
private int timeToComplete;
private int timeGiven;
public Behavior(String behaviorName,
String bodyPart,
int timeToComplete,
int timeGiven)
{
this.behaviorName = behaviorName;
this.bodyPart = bodyPart;
this.timeToComplete = timeToComplete;
this.timeGiven = timeGiven;
}
}
// B
public Behavior class {
public Behavior(String behaviorName,
String bodyPart,
int timeToComplete,
int timeGiven)
{
this.behaviorName = behaviorName;
this.bodyPart = bodyPart;
this.timeToComplete = timeToComplete;
this.timeGiven = timeGiven;
}
}
// C
public class Behavior {
public Behavior()
{
this.behaviorName = behaviorName;
this.bodyPart = bodyPart;
this.timeToComplete = timeToComplete;
this.timeGiven = timeGiven;
}
}
// D
public class Behavior {
private String behaviorName;
private String bodyPart;
private int timeToComplete;
private int timeGiven;
public Behavior()
{
this.behaviorName = behaviorName;
this.bodyPart = bodyPart;
this.timeToComplete = timeToComplete;
this.timeGiven = timeGiven;
}
}
Step by step
Solved in 2 steps with 1 images