+ 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); Ā Ā } }