| | |
Need Help Figuring out errors
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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
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
![]() |
Similar Threads
- errors in program. just want it to compile (C++)
- News Story: Are You Vulnerable to These Top 25 Coding Errors? (Network Security)
- Help with Highscore - figuring out compiling errors and what to do about them (C++)
- Loader.EXE and IEDLL.EXE errors (Web Browsers)
- strange annoying errors (Windows NT / 2000 / XP)
- w2k server errors (Windows NT / 2000 / XP)
- Two Problems- "Page Cannot Be Displayed" Errors, Z (Windows NT / 2000 / XP)
Other Threads in the Java Forum
- Previous Thread: JAVA Permission Blues.. :(
- Next Thread: Storing Point2D.Double objects in an ArrayList.
| Thread Tools | Search this Thread |
Tag cloud for Java
actionlistener android api apple applet application apps arguments array arrays automation balls binary bluetooth card chat class classes clear client code component consumer database draw eclipse ee error event exception fractal free game gameprogramming gis givemetehcodez graphics gui html ide image input integer j2me j2seprojects java javaprojects jni jpanel julia jvm key linux list loop machine map method methods migrate mobile mobiledevelopmentcreatejar myaggfun netbeans newbie nextline nls notdisplaying number oracle output print problem program programming project recursion recursive scanner screen security server set size sms socket sort spamblocker sql sqlite string sun swing terminal test threads time tree trolltech windows





