944,004 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 2501
  • Java RSS
Dec 17th, 2004
0

Need Help Figuring out errors

Expand Post »
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
Similar Threads
Reputation Points: 11
Solved Threads: 0
Newbie Poster
BrownSuga is offline Offline
15 posts
since Sep 2004
Dec 17th, 2004
0

Re: Need Help Figuring out errors

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.
Reputation Points: 11
Solved Threads: 1
Junior Poster in Training
jerbo is offline Offline
84 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: JAVA Permission Blues.. :(
Next Thread in Java Forum Timeline: Storing Point2D.Double objects in an ArrayList.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC