java create a class sphere to accept the radius and find the area and perimeter
Answers
Answer:
In geometry, the area enclosed by a circle of radius r is πr2. Here the Greek letter π represents a constant, approximately equal to 3.14159, which is equal to the ratio of the circumference of any circle to its diameter.
The circumference of a circle is the linear distance around its edge.
Java area and perimeter of a circle
Explanation:
hope it helps
mark me as
and
follow me
Answer:
use io class
Explanation:
import java.io.*;
public class sphere
{
public static void main(String args[]) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the radius ");
int r,a,p;
r = Integer.parseInt(in.readLine());
a = 22/7*r*r:
p = 2*22/7*r;
System.out.println("area= "+a);
System.out.println("perimeter= "+p);
}
}