public class Circle { // Declare the instance data - be sure to use the appropriate visibility modifier // Constructor - takes three int parameters for the x and y coordinates // of the circle and the radius and uses them to initialize the circle. // getRadius - returns the radius // area - computes and returns the area of the circle (type double) // resize - takes one parameter of type int representing the // amount to change the size of the radius; the radius is changed // by that amount // inCircle - takes two parameters x1, y1 of type int representing the // x and y coordinates of a point. The method returns true if the point // specified point (x1,y1) is in the circle (or on the boundary) and // false otherwise // toString - returns a string representation of the circle }
import java.util.Scanner; public class CircleTest { // Use some methods in the Circle class to test them public static void main (String[] args) { int x, y, r; Scanner scan = new Scanner (System.in); System.out.println ("Circle Tester"); System.out.print ("Enter the x and y coordinates of the circle center: "); x = scan.nextInt(); y = scan.nextInt(); System.out.print ("Enter the radius of the circle: "); r = scan.nextInt(); // Declare and instantiate a Circle object with center at // the point (x, y) and radius r. (Name your object testCircle) // Write a statement that prints the area of the circle (invoke // the area method in your print statement) appropriately labeled // Write a statement that increases the radius of testCircle by 5. // Write a statement that prints the new radius of the circle // (invoke the getRadius method in your print statement). // Fill in the blank with a call to the inCircle method to // determine if the point (5, 13) is in testCircle if ( ___________________________________________________ ) System.out.println ("(5, 13) is in the circle"); else System.out.println ("(5, 13) is not in the circle"); // Write a statement that prints the testCircle object } }