10.6 (COMPOSITION: A CIRCLE “HAS A" POINT AT ITS CENTER) A circle has a point at its center. Create a class Point that represents an (x-y) coordinate pair and provides x and y read-write properties for the attributes _x and_y. Include init and repr methods, and a move method that receives x- and y- coordinate values and sets the Point's new location. Create a class Circle that has as its attributes _radius and_point (a Point that represents the Circle's center location). Include init_ and repr methods, and a move method that receives x- and y-coordinate values and sets a new location for the Circle by calling the composed Point object's move method. Test your Circle class by creating a Circle object, displaying its string representation, moving the Circle and displaying its string representation again.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
10.6 (COMPOSITION: A CIRCLE “HAS A" POINT AT ITS CENTER) A circle has
a point at its center. Create a class Point that represents an (x-y) coordinate pair
and provides x and y read-write properties for the attributes _x and_y. Include
init
and
repr methods, and a move method that receives x- and y-
coordinate values and sets the Point's new location. Create a class Circle that
has as its attributes _radius and_point (a Point that represents the Circle's
center location). Include
init_ and
repr
methods, and a move method
that receives x- and y-coordinate values and sets a new location for the Circle by
calling the composed Point object's move method. Test your Circle class by
creating a Circle object, displaying its string representation, moving the Circle
and displaying its string representation again.
Transcribed Image Text:10.6 (COMPOSITION: A CIRCLE “HAS A" POINT AT ITS CENTER) A circle has a point at its center. Create a class Point that represents an (x-y) coordinate pair and provides x and y read-write properties for the attributes _x and_y. Include init and repr methods, and a move method that receives x- and y- coordinate values and sets the Point's new location. Create a class Circle that has as its attributes _radius and_point (a Point that represents the Circle's center location). Include init_ and repr methods, and a move method that receives x- and y-coordinate values and sets a new location for the Circle by calling the composed Point object's move method. Test your Circle class by creating a Circle object, displaying its string representation, moving the Circle and displaying its string representation again.
Expert Solution
Step 1

Algorithm:

  1. Start
  2. Create a Point class with x and y as its attributes
  3. Implement constructor to Initialize the data 
  4. Implement __repr__() method to print the Point object 
  5. Implement move() which sets x and y attributes to new values
  6. Create a Circle class with point which is an object of Point class and radius as its attributes 
  7. Implement constructor to Initialize the data 
  8. Implement move() method which calls move() method of Point class
  9. Implement __repr__() method to print the Circle object
  10. Inside the main method, create an object of Circle class and then print the Circle object. 
  11. Call move() method of Circle object and then print Circle object
  12. Stop
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY