I have this class:
public class Vehicle {
private float speed;
public void decelerationSpeed()
{
--speed;
}
}
Each time decelerationSpeed
method have been called speed variable decreased by one.
I need to change decelerationSpeed
method this way that, if speed variable reached to zero and decelerationSpeed
method have been called the speed value doesn't have to be changed.
In this tutorial I can't use if else or any other conditional operators(I think I have to manipulate with modulo and divide operations).