1. Design a class called Circle. The circle is defined by its center (x,y) and radius r. Here is the UML for the class: Circle -int x //x coord of the center -int y // y coord of the center -int radius + Circle() //default constructor that sets origin to (0,0) and radius to 1 +Circle(int x, int y, int radius) // regular constructor +getX(): int +getY(): int +getRadius(): int +setX(int newX: void +setY(int newY): void +setRadius(int newRadius):void +getArea(): double // returns the area using formula pi*r^2 +getCircumference // returns the circumference using the formula 2*pi*r +toString(): String // return the circle as a string in the form (x,y) : radius 2. make a specification file called CircleHeader.h which contains the class specification with member variable (attribute) declarations and function (aka instance method) headers 3. make a file called Circle.cpp which implements the Circle class as given in the UML diagram above. This file will implement instance methods (behaviors/functions that initialize, access and process data). These function names will be prefixed with the class name followed by the scope resolution operator :: to indicate which class they are declared in 4. make a driver class called CircleMain.cpp to do the following: a. Declare and instantiate a circle called circleOne using the default constructor b. Declare and instantiate a circle called circleTwo with center at origin and radius =4. c. Display the circles in the format (x,y):radius using getter methods for getting x, y and radius d. Declare and instantiate a circle called circleThree with at (-2,-9) and radius =6 e. Display circleThree in the format (x,y):radius using the toString method f. Display the areas and circumferences of all the circles g. Include math.h and use M_PI for PI in calculations 5. Make sure your program has good documentation and correct programming style 6. Your program needs to follow top down design

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
100%

M02    C++

1. Design a class called Circle. The circle is defined by its center (x,y) and radius r. 
Here is the UML for the class: 
Circle
-int x //x coord of the center
-int y // y coord of the center
-int radius
+ Circle() //default constructor that sets origin to (0,0) and radius to 1
+Circle(int x, int y, int radius) // regular constructor
+getX(): int
+getY(): int
+getRadius(): int
+setX(int newX: void
+setY(int newY): void
+setRadius(int newRadius):void
+getArea(): double // returns the area using formula pi*r^2
+getCircumference // returns the circumference using the formula 2*pi*r
+toString(): String // return the circle as a string in the form (x,y) : radius
2. make a specification file called CircleHeader.h which contains the class specification 
with member variable (attribute) declarations and function (aka instance method) 
headers
3. make a file called Circle.cpp which implements the Circle class as given in the UML 
diagram above. This file will implement instance methods (behaviors/functions that 
initialize, access and process data). These function names will be prefixed with the class 
name followed by the scope resolution operator :: to indicate which class they are 
declared in
4. make a driver class called CircleMain.cpp to do the following:
a. Declare and instantiate a circle called circleOne using the default constructor

 

 

b. Declare and instantiate a circle called circleTwo with center at origin and radius 
=4.
c. Display the circles in the format (x,y):radius using getter methods for getting x, y 
and radius
d. Declare and instantiate a circle called circleThree with at (-2,-9) and radius =6
e. Display circleThree in the format (x,y):radius using the toString method
f. Display the areas and circumferences of all the circles
g. Include math.h and use M_PI for PI in calculations
5. Make sure your program has good documentation and correct programming style
6. Your program needs to follow top down design

 

 

Expert Solution
steps

Step by step

Solved in 5 steps with 1 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
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