Hi,

I wrote a code with two classes in it- Circle class which is used to calculate circle circumference and area according to the radius entered by users, and Validator which makes sure users enter positive value as radius and only enter y or n when asked if they want to continue next circle calculation. It worked when i put the main method at the end of the Circle class, but when i tried to separate the driver and the business logic class, it didn't work.

Part of the class code, the driver code and compiler error info is as following, appreciate any input or advice.



public class Circle{
double radius = 0;
double circumference = 0;
double area = 0;
static int objectCount=0;

public Circle(double radius) {
this.radius = radius; }

public double getCircumference(){
circumference = 2 * Math.PI * radius;
return circumference;}
....
}
public static void circleCalculation(double radius)
{}

}
class Validator
{...}




the driver code:
public class CircleApp
{
public static void main(String[] args)
{
Circle c = new Circle(double radius);
Validator myValidator = new Validator();
System.out.println("Welcome to the Circle Calculator" );
Scanner sc = new Scanner(System.in);

String choice = null;
do{
double radius = Validator.validDoubleWithinRange(sc, "Enter radius: ", 0, 180.0);
double circumference =c.getCircumference();
System.out.println("Circumference: " + circumference);

choice = Validator.validYesNo(sc, "Continue? (y/n): ");
System.out.println();
}
while(choice.equals("y"));
System.out.println("Goodbye.");
}
}

the compiler error message:
CircleApp.java:8: error: '.class' expected
Circle c = new Circle(double radius);
CircleApp.java:8: error: ';' expected
Circle c = new Circle(double radius);