for example i have a result of circle area = 4.3, my question is 'when i get number grater than .5 [for example(4.6, 4.7, 4.8, 4.9)], i want it to give me 5.0, but if less than .5 [4.4, 4.3, 4.2, 4.1] then show me 4.0'
i tried Math.round()
but it converts float to int like [4], but i don't want to convert it to int
is there a way to do this?
here is my code:
private float radius;
private double result;
public void show(float x)
{
this.radius = x;
this.result=Math.pow(x,2)*Math.PI;
System.out.println("result is: "+result);
}
clearly, i want both method(Math.floor()) and (Math.ceil()) in one function thanks