Question: The following code contains many errors. The errors may be syntax, logic, or violations of conventions discussed in class. Copy this code into DrJava and
The following code contains many errors. The errors may be syntax, logic, or violations of conventions discussed in class. Copy this code into DrJava and make any necessary corrections to the code so that it compiles and produces the required output when run. Also, make sure that all naming conventions are followed.
// Calculates the area & circumference of a circle & return the area value
Public class CircleStats {
public static void main(String[] args) {
Scanner console = new Scanner();
int area = stats(console);
}
// This method prints the
public static String Stats(Scanner console) {
system.out.print("Enter the diameter of a circle: )
int diameter = console.nextDouble;
double radius = diameter/2;
System.out.println("For a circle with Radius =" + Radius);
System.out.println(" The circumference is: " + PI * diameter);
System.out.println(" and the area is: " + PI * radius ^ 2;
};
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
