5. Given the Java Point class (which contains two private variables x and y and constructors that allows creating a point object with known x and y values as well as other methods such as equals( ), toString( ) etc), (a). define a new class called Circle that contains private two variables: center which is a Point object from the Point class and radius which is of type double. The Circle class must have the following methods: (b). add a constructor which creates a circle object using a center point with x and y values and a radius as its parameters. (c). add a default constructor. ( (d). add an equals() method that can compare if any object is equal to a Circle object (two circle objects are equal if they have the same center point with the same radius). (e). add a toString() method that prints a Circle object with the center point and radius.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question
5. Given the Java Point class (which contains two private variables x and y and constructors that allows creating a point object with known x and y values as well as other methods such as equals( ), toString( ) etc), (a). define a new class called Circle that contains private two variables: center which is a Point object from the Point class and radius which is of type double. The Circle class must have the following methods: (b). add a constructor which creates a circle object using a center point with x and y values and a radius as its parameters. (c). add a default constructor. ( (d). add an equals() method that can compare if any object is equal to a Circle object (two circle objects are equal if they have the same center point with the same radius). (e). add a toString() method that prints a Circle object with the center point and radius.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning