Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given the following class definition /** * Class name: Circle * Role: Represent a 2D Circle with center (x,y) coordination and a radius public class
Given the following class definition /** * Class name: Circle * Role: Represent a 2D Circle with center (x,y) coordination and a radius public class Circle { private double radius; //the radius of the Circle private double x; //the center location on the x-axis private double y; //the center location on the y-axis /* * This constructor will initialize the instance variables with * 3 input parameters of x, y locations and radius public Circle(double in_x, double in_y, double in_r) { //TODO: Complete the constructor method //in_x, in_y, and in_r are the input parameters //for the x, y, and radius correspondingly } * This method calculates and returns the area of the Circle public double getArea() { //TODO: Complete this method to return the area of the Circle } * This method calculates and returns the perimeter of the Circle public double getPerimeter() { //TODO: Complete this method to return the perimeter of the Circle * This method calculates and returns the perimeter of the Circle public double getPerimeter() { //TODO: Complete this method to return the perimeter of the Circle } * The main method to test the Circle class public static void main(String[] args) { // TODO: create a Circle object with coordinates x=3 and y=4, and radius=1, then output the area and perimeter. The sample output format is as follows: Area is 3.1415926 and perimeter is 6.2831852. } Complete the missing code and test the program. Requirement: In the Answer Box, please copy the code first and then add your own code in the TODO
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started