Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

More Books

Students also viewed these Databases questions

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago