void setup ()
{
// Part (a)
Circle c1 = new Circle();
c1.x = 4;
c1.y = -1;
c1.r = 3;
Circle c2 = new Circle();
c2.x = 3;
c2.y = -2;
c2.r = 5;
// Part (b)
println(c1.area());
// Part (c)
Circle small = c1.smaller(c2);
println("Smaller circle has centre: "
+ "(" + small.x + "," + small.y
+ ") and radius " + small.r);
// Part (d)
if (c2.isInside(c1))
println("c2 lies entirely within c1.");
else
println("c2 does not lie entirely within c1.");
}
|