Following the topic of 2D simulations, imagine we have an interface of a simulated physical object, as well as an implementation of this interface in an instance of this object – in our case, a Stone.
data class Vector2(var x: Int, var y: Int)
interface PhysicalBody2D {
val affectedByGravity: Boolean
get() = true
val simulated: Boolean
get() = true
val mass : Double
val gravityStrength : Double
val velocity : Vector2
// You don't need to implement these functions
fun simulate()
fun stopSimulation()
fun setVelocityToZero()
}
However, the interface was not implemented properly. Correct the implementation, considering that the Stone
1) Is supposed to have the mass of 0.25;
2) Is supposed to have zero velocity;
3) Is also supposed to be normally affected by gravity.