Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAM HELP: I need the following code. Write a class named Circle which represents a circle shape as described below: 1. Two attributes, color

JAVA PROGRAM HELP: I need the following code.

image text in transcribed

Write a class named Circle which represents a circle shape as described below: 1. Two attributes, color and radius. 2. A default constructor which initializes the attributes to red and 5, respectively. 3. A copy constructor. 4. A compareTo() method to determine if two Circle objects are the equal. Equality should be defined as the same color and the same radius. 5. A toString() method that returns the color and radius as a string. 6. A set function that allows the color of an object to be changed. 7. A set function that allows the radius of an object to be changed. Write a second class with a main function that declares two Circle objects: C1 and C2. Create a copy of C2 in a third object, C3 Compare the C1 and C2 and print the results. Change the color of C1. Compare C1 and C3 and print the results. Set the radius of C2 to 20. Print the results of toString() for C2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

LO1 Summarize the organizations strategic planning process.

Answered: 1 week ago