954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need Help Figuring out errors

This is the error message I am getting and the driver and class is below it.
Thank You if you can help me :)


C:\My Documents\CS151\CircleSolutionDriver.java:18: cannot resolve symbol
symbol : constructor Circle ()
location: class Circle
Circle circle = new Circle();
^
1 error

Tool completed with exit code 1


This is the driver:

* This program calculates the circumference of a circle or the area of a circle
* depending on which one the user needs at the time. This program will also
* give the user the option of the concepts and the formula that will be used in
* the solution.
***********************************************************************************************/

public class CircleSolutionDriver
{
public static void main(String[] args)
{

//Create an object, enter data, process, and display information

Circle circle = new Circle();


circle.CircleInfo();
circle.calculate();

}//end main
} //end CircleSolutionDriver


This is the class:

* This program calculates the circumference of a circle or the area of a circle
* depending on which one the user needs at the time. This program will also
* give the user the option of the concepts and the formula that will be used in
* the solution.
***********************************************************************************************/

import java.text.DecimalFormat;

public class Circle
{
public double perimeter;
public double area;
public double radius;
public char response;

//********************************************************************************************

//This constructor assigns the values into instance variables

public Circle(double radius)
{
this.radius = radius;
}// end CircleSolution constructor
//*********************************************************************************************
//This constructor method inputs

public void CircleInfo()
{
System.out.print("Please enter the radius of the circle: ");
radius = Input.readDouble();
System.out.print("Please enter which formula you would like calculated.");
System.out.print("P for Perimeter or A for area:");
response = Input.readChar();
}//end constructor
//***********************************************************************************************
//This method calculates the perimeter and the area and prints the results

public void calculate()
{

if((response == 'P') || (response == 'p'))
{
System.out.print("Would you like to see the formula that will be used to calculate the perimeter?");

if ((response == 'Y') || (response == 'y'))
{
System.out.print("The perimeter is calculated by PI= 3.14159 * radius * 2.0.");
System.out.print("The perimeter is the sum of the lengths of sides of the circle.");
}
else if ((response == 'N') || (response == 'n'))
{
perimeter = (Math.PI) * radius * 2.0;
DecimalFormat fixedFormat = new DecimalFormat ("##0.000##");
System.out.print("The perimeter of your circle is: " + fixedFormat.format(perimeter));
}
}
if((response == 'A') || (response == 'a'))
{
System.out.print("Would you like to see the formula that will be used to calculate the area?");
if((response == 'Y') || (response == 'y'))
{
System.out.print("The area is calculated by area = PI = 3.14159 * radius * radius.");
System.out.print("The area ia the term for the measurment of the amount of surface ocupied by the circle.");
}
else if((response == 'N') || (response == 'n'))
{
area = (Math.PI) * radius * radius;
System.out.print("The area of your circle is: " + area);
}
}
}

//************************************************************************************************
//This method returns the radius

public double getRadius()
{
return radius;
}//end getRadius

//************************************************************************************************
//This method changes the radius

public void setRadius(double nRadius)
{
radius = nRadius;
}//end setRadius

//***********************************************************************************************


}// end class Circle

BrownSuga
Newbie Poster
15 posts since Sep 2004
Reputation Points: 11
Solved Threads: 0
 

First glance is you defined a constructor with a parameter. If you define a constructor with a parameter, you also need to define the default constructor.

jerbo
Junior Poster in Training
84 posts since Sep 2004
Reputation Points: 11
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You