Forgive me if this has been asked, but I searched for pi and Math.PI and class and float and couldn't find anything relevant.
Problem as follows:
a number which is a radius
area and circumference of the circle with input as radius
volume and surface area of the sphere with input as radius
I got a working class, but when I attempted to change the variables to floats, in the interest of learning, it errored out. The reason is that Math.PI yields a double. I tried:
float pi = Math.PIF
That doesn't work. The only way I was able to have a working class using floats, I had to initialize pi as follows:
pi = 22/7F
Is there a way to use Java's Math.PI as a float?