1. Suppose making a class called Day. Two of its variables are year and currentTemperature. The step is Year should be a final variable, and currentTemperature should not be final. Can you explain why?
1. Suppose making a class called Day. Two of its variables are year and currentTemperature.
The step is
Year should be a final variable, and currentTemperature should not be final.
Can you explain why?
2. When we write a unit test only basing the test on the documentation, which tells us what the function is supposed to do, this is an example of a: Black Box Test
Can you explain!
3.
Assuming working on a project that involves
The code is below. Please explain.
/** Kick checks if the player can kick the ball, and if yes, kicks the ball
*
* @param b A ball object to kick
* @returns false if they cannot kick, otherwise true
*/
public boolean kick(Ball b) {
double d = distance(this.getLocation(), b.getLocation());
// people need to be closer than 1 distance to kick the ball
if (d < 1.0) {
//get
Vector v = getVector(this.getLocation(), b.getLocation());
newLocation = b.getLocation() + v * this.kickForce;
b.setLocation(newLocation);
} else {
return false;
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps