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.
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...
Related questions
Question
Expert Solution
Step 1
Algorithm:
- Start
- Create a Point class with x and y as its attributes
- Implement constructor to Initialize the data
- Implement __repr__() method to print the Point object
- Implement move() which sets x and y attributes to new values
- Create a Circle class with point which is an object of Point class and radius as its attributes
- Implement constructor to Initialize the data
- Implement move() method which calls move() method of Point class
- Implement __repr__() method to print the Circle object
- Inside the main method, create an object of Circle class and then print the Circle object.
- Call move() method of Circle object and then print Circle object
- Stop
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
Recommended textbooks for you
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY