Untitled

mail@pastecode.io avatar
unknown
java
a year ago
978 B
1
Indexable
Never
package AssignTwo;
import java.util.*;
public class QuestionFour 
{
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Please enter the radius");
        System.out.println("Please enter the number of objects");
        double radius = scanner.nextDouble();
        int numberOfObjects = scanner.nextInt();
        Circle circle = new Circle();
        Circle circle1 = new Circle(radius);

    }
}
class Circle
{
    private double radius; 
    private int numberOfObjects;
    Circle(){};
    Circle(double radius)
    {
        this.radius = radius;
    }

    public double getRadius()
    {
        return radius;
    }
    public void setRadius(double radius)
    {
        this.radius = radius;
    }

    public int getNumberOfObjects()
    {
        return numberOfObjects;
    }
    public double getArea()
    {
       double area = Math.PI * Math.pow(radius,2);
       return area;
    }
}