: Write the Class for Circle. Read the following code and create the attributes, method, constructors of class according so that it produces the result as given below.Code:public class Main {
public static void main(String[] args) {System.out.println("Value of PI: "+ Circle.PI);System.out.println("Square of 2.0 is: " + Circle.square(2.0));Circle c1 = new Circle(3.4);Circle c2 = new Circle(2.9);c1.display();c2.display();System.out.println(c1.compare(c2));System.out.println(c2.compare(c1));c1 = c2.getCopy();System.out.println(c1.compare(c2));System.out.println(c2.compare(c1));c1.set(5.0);System.out.println(c1.getRadius());System.out.println(c1.getDiameter());System.out.println(c1.getCircumference());System.out.println(c1.getArea());Circle c3 = c2.getClone();c3.set(c1.getDiameter());c2.display();c3.set(c1);c1.display();c2.display();c3.display();}}Output:Value of PI: 3.14Square of 2.0 is: 4.0Radius: 3.4, Diameter: 6.8, Circumference: 21.352, Area: 36.2984Radius: 2.9, Diameter: 5.8, Circumference: 18.212, Area: 26.4074000000000031-1005.010.031.40000000000000278.5Radius: 10.0, Diameter: 20.0, Circumference: 62.800000000000004, Area: 314.0Radius: 5.0, Diameter: 10.0, Circumference: 31.400000000000002, Area: 78.5Radius: 5.0, Diameter: 10.0, Circumference: 31.400000000000002, Area: 78.5Radius: 5.0, Diameter: 10.0, Circumference: 31.400000000000002, Area: 78.5
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here