WAP a programme to find Area and Circumference of Circle using Constructor and Methods

import java.io.*;
class Circle
{
Double r;
Circle(double radius)
{
r=radius;
}
public void Area()
{
System.out.println("area of circle is :"+3.14*r*r);
}
public void Circumference()
{
System.out.println("circumference of circle is :"+6.28*r);
}

public static void main(String args[])
{
double radius=0.0;
BufferedReader bf= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the value od radius:");
try
{
radius=Double.parseDouble(bf.readLine());
}
catch(Exception e)
{
e.printStackTrace();
}
Circle C= new Circle(radius);
C.Area();
C.Circumference();
}
}


Comments