Help me I am trying to get this code to work.

Here is what my compiler is telling me: GeometryCalculator.java:20: error: constructor Sphere in class Sphere cannot be applied to given types;

Sphere sp = new Sphere(r);

^

required: no arguments

found: double

reason: actual and formal argument lists differ in length

Code java:

import java.util.Scanner;
/**
This is a test driver for the Sphere, Cylinder, and Cone class
This approach is more object-oriented than the previous one because
it clearly separates the duties of each class.
*/
public class GeometryCalculator
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Please enter the radius: ");
double r = in.nextDouble();
System.out.println("Please enter the height: ");
double h = in.nextDouble();
Sphere sp = new Sphere(r);
double v = sp.getVolume();
double s = sp.getSurfaceArea();
System.out.println("The volume of the sphere is: " + v);
System.out.println("The surface area of the sphere is: " + s);
Cylinder cy = new Cylinder(r, h);
v = cy.getVolume();
s = cy.getSurfaceArea();
System.out.println("The volume of the cylinder is: " + v);
System.out.println("The surface area of the cylinder is: " + s);
Cone co = new Cone(r, h);
v = co.getVolume();
s = co.getSurfaceArea();
System.out.println("The volume of the cone is: " + v);
System.out.println("The surface area of the cone is: " + s);
}
}

Code java:

/**
This class provides methods to compute the volume and surface area of a sphere.
@author:
@version:
*/
public class Sphere
{
/**
Constructs a Sphere object with input: radius.
@param aRadius the radius
*/
Sphereobject sphere = new Sphereobject();
/**
Computes the volume of a sphere.
@return volume of sphere
*/
public static double Computevolume(double r){
double Volume = 4/3*Math.PI*r * Math.pow(r,2);
return Volume;
}
/**
Computes the surface area of a sphere.
@return surface area of a sphere
*/
public static double computeSurfaceArea(double r){
double SurfaceArea = 4*Math.PI* Math.pow(r,2);
return SurfaceArea;
}
private double r;
}

Code java:

public class Sphereobject
{
public static void main(String[] args)
{
Sphere Sphere1 = new Sphere ();
}
}

--- Update ---

I left some comments so it would be easier to understand what I had to do but now I am completely confused as to what I have to do to fix this.

Re: Help me I am trying to get this code to work.

Quote:

Sphere sp = new Sphere(r);

^

required: no arguments

found: double

reason: actual and formal argument lists differ in length

The compiler can not find a constructor for the Sphere class that takes a double.

Either remove the double arg (r) passed to the constructor

or add a constructor to the Sphere class that takes a double as arg

Re: Help me I am trying to get this code to work.

How would I do the latter? just put in (double r)?

Re: Help me I am trying to get this code to work.