+ 4
Program to calculate area and circumference of circle using constructor in java??
2 Answers
+ 6
Ms. Nothing please show us your code so we can help you or atleast guide you.
The basic formulas were given in the project as
int areaofSq = s * s;
double areaofCr = Math.PI * r * r;
+ 1
import java.util.Scanner; public class CircumfrenceOfCircle { Â Â public static void main(String args[]){ Â Â Â iimport java.util.Scanner;
public class CircumfrenceOfCircle {
public static void main(String args[]){
int radius;
double circumference;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the radius of the circle ::");
radius = sc.nextInt();
circumference = Math.PI*2*radius;
System.out.println("Circumference of the circle is ::"+circumference);
}
}nt radius; Â Â Â double circumference; Â Â Â Scanner sc = new Scanner(System.in); Â Â Â System.out.println("Enter the radius of the circle ::"); Â Â Â radius = sc.nextInt(); Â Â Â circumference = Math.PI*2*radius; Â Â Â System.out.println("Circumference of the circle is ::"+circumference); Â Â } }