Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a method that has the radius of the circle passed into it. It computes the

ID: 3532324 • Letter: W

Question

Write a method that has the radius of the circle passed into it. It computes the area, and returns the area to the main method.

Also, write a line of code that might "call" the method from the main method. Example:   x = theMethod(z);


This is what I have so far:

public class Circle {

            public static double circleArea (double radius) {

                        double area = radius * radius * Math.PI ;

                        return area ;

            }

// Main method

            public static void main(String[ ] args) {

                        double radius = 0

                        try{

Explanation / Answer

Code for beginner like you, easy to understand,plz comment if have any doubt


import java.util.*;

class Circle

{

public Circle()

{

}

public double circleArea (int radius)

{

double area = radius * radius * Math.PI ;

return area ;

}

}

class Program

{

public static void main(String args[])

{

Scanner s= new Scanner(System.in);

int r= s.nextInt();

Circle c= new Circle();

double area=c.circleArea(r);

System.out.println("Area "+area);

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote