Question: The following program is supposed to assign a diameter to a circle and then print the circle's area. can you find all the bugs in
The following program is supposed to assign a diameter to a circle and then print the circle's area. can you find all the bugs in the program and fix them. please do not change any of the method headings
Public class PlayCircle
{
private double diameter;
public void setDiameter(double diameter)
{
Circle.diameter = diameter;
}
public void showArea()
{
double radius;
radius = circle.diameter / 2;
System.out.printIn("Area is " + (Math.PI * radius * radius));
}
public static void main(String[] args)
{
PlayCircle circle;
circle.setDiameter(4.0);
showArea();
}
} // end PlayCircle class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
