Program to calculate area and circumference of circle using constructor in java?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Program to calculate area and circumference of circle using constructor in java??

18th Jan 2023, 4:15 AM
Ms. Nothing
Ms. Nothing - avatar
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;
18th Jan 2023, 4:33 AM
BroFar
BroFar - avatar
+ 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);    } }
27th Jan 2023, 8:40 PM
Pietro Maximoff
Pietro Maximoff - avatar