Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class to model a circle. Name this class Circle 1. The class should include data members for radius, x and y. 2. Include

Create a class to model a circle. Name this class Circle 

1. The class should include data members for radius, x and y. 

2. Include a default and explicit constructor. The explicit constructor will receive a radius value and an x.y coordinate. Make sure that the default constructor sets the radius to 1 x.y position to 1,1 

3. Include setter/getter member methods for each data member. 

4. Include methods for computing the circumference and area 

Test this class by instantiating Circle objects as follows: 

  • Instantiate three Circle objects, cl,c2, and c3. Use explicit values in the construction of cl and c2. Allow the default constructor to assign default values to c3. 
  • Use the setRadius0 setter method to re-assign cl a small radius value and c2 a larger radius value. 
  • Do NOT re-assign the third circle a radius value; instead, retain the value assigned at construction. 
  • Display all the values for all the Circle objects

Step by Step Solution

3.34 Rating (160 Votes )

There are 3 Steps involved in it

Step: 1

Circle Class package myPackage public class Circle Data Members double radius int x x coordinate int y y coordinate Default Constructor Circle thisrad... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java Programming

Authors: Joyce Farrell

9th edition

1337397075, 978-1337397070

More Books

Students also viewed these Programming questions

Question

9.3 Evaluate methods used to treat eating disorders.

Answered: 1 week ago