Hi everyone, I am brand new to Java and I like it a lot so far. I am very stuck on an assignment for school that I need help with. We are just learning about method invocation, how to write and call methods in Java. My program should take user generated input for a radius value and output the volume, area, and radius of a sphere in a dialoge box. The Output/Input classes are just classes my professor wrote to allow us a pretty interface (we haven't used sys.out.println yet). I cannot get my method invocation to work. The compilation window tells me the the variables in my method invocation are not yet declared. I am stuck. Help would be so appreciated! thanks
Here is what I've got:
public class Sphere
{
public static void sphereOut(double rad, double volume, double a)
{
String menu = "Your radius is: " +rad+ "\n";
menu = menu + "Your volume is: " +volume+ "\n";
menu = menu + "Your area is: " +a;
Output.showMessage(menu);
}//method sphereOut
public static double area (double rad)
{
double a;
a = 4.0 * 3.14 * rad * rad;
return a;
}//method area
public static double volume (double volume)
{
double volume
4.0/3.0 * 3.14 * rad * rad * rad;
return volume;
}//method volume
public static double getRadius ()
{
double rad;
rad = Input.readDouble("Enter a positive radius");
while (rad < 0)
rad = Input.readDouble("Error enter a positive value");
Output.showValue("The radius you entered is: ", rad);
return rad;
}//method getRadius
public static void main(String [] args)
{
Sphere.getRadius();
Sphere.volume(volume);
Sphere.area(rad);
Sphere.sphereOut(rad, volume, a);
}//method main
}//class Sphere