Ran this program get an error at the test program. I think there is problem conn
ID: 3627710 • Letter: R
Question
Ran this program get an error at the test program. I think there is problem connecting the two programs. I get an error which says that cannot find symbol.import java.util.Scanner;
public class CircleArea
{
public void CircleArea()
{
Scanner input = new Scanner( System.in );
double radius = 0;
double area = 0;
System.out.print( "Enter radius: " );
radius = input.nextDouble();
System.out.printf( "Circle Area is %.2f/n/n", area);
} // end of CircleArea method
public double area( double radius )
{
return 3.14 * radius * radius;
} //
} // end of CircleArea Class
public class CircleAreaTest
{
public static void main( String[] args )
{
CircleArea circleArea = new CircleArea();
circleArea.circleArea();
} // end of main method
} // end of CircleAreaTest class
Explanation / Answer
public class CircleArea
{
public void circleArea()
{
Scanner input = new Scanner( System.in );
double radius = 0;
System.out.print( "Enter radius: " );
radius = input.nextDouble();
System.out.printf( "Circle Area is %.2f ", area(radius));
} // end of CircleArea method
public double area( double radius )
{
return 3.14 * radius * radius;
} //
} // end of CircleArea Class
public static void main( String[] args )
{
CircleArea circleArea = new CircleArea();
circleArea.circleArea();
} // end of main method
} // end of CircleAreaTest class
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.