C++ Specifications: 1. Extend Circle class in Lab 2. Add the functions marked with *** in the following UML 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 +getDistance(Circle other): double // *** returns the distance between the center of this circle and the other circle +moveTo(int newX,int newY):void // *** move the center of the circle to the new coordinates +intersects(Circle other): bool //*** returns true if the distance between the two centers is less than the sum of their radii. +resize(double scale):void// *** multiply the radius by the scale +resize(int scale):Circle // *** returns a new Circle with the same center as this circle but radius multiplied by scale //note that the resize function is an overloaded function. The definitions have different signatures 2. Create a file called CircleHeader.h (header file) which contains the Circle class specification. A specification file contains the class definition with the name, member variables and the function prototypes. 3. Create a file called Circle.cpp (implementation file) which contains the function implementation of all the functions in the header file. 4. Create 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 the toString method d. Display the distance between the two circles using getDistance method e. Check if circleOne intersects circleTwo. Display the results f. Create a circleThree by using the resize function with a scale of integer 10 on circleTwo g. Move circleThree to (4,5) h. Check if circleTwo intersects circleThree. Display the results. i. Create a fourth Circle, circleFour at center (4,5) and radius =1 j. Check if circleFour intersects circleOne. Display the results. k. Use resize function to increase the radius of circleThree by a factor 9.5 (note the double Your output needs to look like this: LAB2: Main.cpp: #include "CircleHeader.h" #include using namespace std; int main() { //creating first object Circle circleOne; //creating second object Circle circleTwo(0,0,4); //displaying first and second Circle cout<<"Circle one is : "<<"("< #include using namespace std; //declaring class class Circle { //private data members declaration int x; int y; int radius; public: //default constructor Circle(); //parameterised constructor Circle(int X, int Y, int Radius); //declaration of setters int getX(); int getY(); int getRadius(); //declaration of getters void setX(int newX); void setY(int newY); void setRadius(int newRadius); //declaration of functions to find area and Circumference double getArea(); double getCircumference(); string toString(); }; #endif Circle.cpp: //this file contains the definition of member functions of the class #include #include "CircleHeader.h" #include #include using namespace std; Circle::Circle() { x=0; y=0; radius=1; } Circle::Circle(int x, int y, int radius) { this->x=x; this->y=y; this->radius=radius; } int Circle::getX() { return x; } int Circle::getY() { return y; } int Circle::getRadius() { return radius; } void Circle::setX(int newX) { x=newX; } void Circle::setY(int newY) { y=newY; } void Circle::setRadius(int newRadius) { radius=newRadius; } double Circle::getArea() { double area=M_PI*radius*radius; return area; } double Circle::getCircumference() { double Circumference=2*M_PI*radius; return Circumference; } string Circle::toString() { string s; s="("+to_string(getX())+","+to_string(getY())+"):"+to_string(getRadius()); return s; }

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%
C++ 
Specifications:
1. Extend Circle class  in Lab 2. Add the functions marked with *** in the
following UML
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
+getDistance(Circle other): double // *** returns the distance between the center of this circle
and the other circle
+moveTo(int newX,int newY):void // *** move the center of the circle to the new coordinates
+intersects(Circle other): bool //*** returns true if the distance between the two centers is less
than the sum of their radii.
+resize(double scale):void// *** multiply the radius by the scale
 
 
+resize(int scale):Circle // *** returns a new Circle with the same center as this circle but
radius multiplied by scale
//note that the resize function is an overloaded function. The definitions have different
signatures
2. Create a file called CircleHeader.h (header file) which contains the Circle class specification.
A specification file contains the class definition with the name, member variables and the
function prototypes.
3. Create a file called Circle.cpp (implementation file) which contains the function
implementation of all the functions in the header file.
4. Create 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 the toString method
d. Display the distance between the two circles using getDistance method
e. Check if circleOne intersects circleTwo. Display the results
f. Create a circleThree by using the resize function with a scale of integer 10 on
circleTwo
g. Move circleThree to (4,5)
h. Check if circleTwo intersects circleThree. Display the results.
i. Create a fourth Circle, circleFour at center (4,5) and radius =1
j. Check if circleFour intersects circleOne. Display the results.
k. Use resize function to increase the radius of circleThree by a factor 9.5 (note the
double
 
Your output needs to look like this:
 
 
 
 

LAB2: 
Main.cpp:

#include "CircleHeader.h"
#include <iostream>

using namespace std;

int main()
{
//creating first object
Circle circleOne;
//creating second object
Circle circleTwo(0,0,4);
//displaying first and second Circle
cout<<"Circle one is : "<<"("<<circleOne.getX()<<","<<circleOne.getY()<<"):"<<circleOne.getRadius()<<endl;
cout<<"Circle Two is : "<<"("<<circleTwo.getX()<<","<<circleTwo.getY()<<"):"<<circleTwo.getRadius()<<endl;
//creating third Circle object
Circle circleThree(-2,-9,6);
//displaying third circle
cout<<"circle Three is : "<<circleThree.toString()<<endl;
//displaying area of all circles
cout<<"Area of circle One is : "<<circleOne.getArea()<<endl;
cout<<"Area of circle Two is : "<<circleTwo.getArea()<<endl;
cout<<"Area of circle Three is : "<<circleThree.getArea()<<endl;
//displaying Circumference of all circles
cout<<"Circumference of circle One is : "<<circleOne.getCircumference()<<endl;
cout<<"Circumference of circle Two is : "<<circleTwo.getCircumference()<<endl;
cout<<"Circumference of circle Three is : "<<circleThree.getCircumference()<<endl;
return 0;
}

 CircleHeader.h:

#ifndef CircleHeader_H

#define CircleHeader_H
#include<string.h>
#include<iostream>
using namespace std;
//declaring class
class Circle
{
//private data members declaration
int x;
int y;
int radius;
public:
//default constructor
Circle();
//parameterised constructor
Circle(int X, int Y, int Radius);
//declaration of setters
int getX();
int getY();
int getRadius();
//declaration of getters
void setX(int newX);
void setY(int newY);
void setRadius(int newRadius);
//declaration of functions to find area and Circumference
double getArea();
double getCircumference();
string toString();
};

#endif

 Circle.cpp:

//this file contains the definition of member functions of the class

#include<iostream>
#include "CircleHeader.h"
#include<string.h>
#include<math.h>
using namespace std;

Circle::Circle()
{
x=0;
y=0;
radius=1;
}

Circle::Circle(int x, int y, int radius)
{
this->x=x;
this->y=y;
this->radius=radius;
}

int Circle::getX()
{
return x;
}
int Circle::getY()
{
return y;
}
int Circle::getRadius()
{
return radius;
}

void Circle::setX(int newX)
{
x=newX;
}
void Circle::setY(int newY)
{
y=newY;
}
void Circle::setRadius(int newRadius)
{
radius=newRadius;
}

double Circle::getArea()
{
double area=M_PI*radius*radius;
return area;
}

double Circle::getCircumference()
{
double Circumference=2*M_PI*radius;
return Circumference;
}

string Circle::toString()
{
string s;
s="("+to_string(getX())+","+to_string(getY())+"):"+to_string(getRadius());
return s;
}

 
First Circle (0,0):1
Second Circle (0,0): 4
The distance between the two circles is: 0
The circles do intersect
Third Circle created (0,0): 40
Moved circle Three - (4,5):40
The circles Second and Third do intersect
Fourth Circle created (4,5):1
The circles First and Fourth do not intersect
Resized circle Three - (4,5):380
Transcribed Image Text:First Circle (0,0):1 Second Circle (0,0): 4 The distance between the two circles is: 0 The circles do intersect Third Circle created (0,0): 40 Moved circle Three - (4,5):40 The circles Second and Third do intersect Fourth Circle created (4,5):1 The circles First and Fourth do not intersect Resized circle Three - (4,5):380
Expert Solution
Step 1

BELOW ? STEP BY STEP COMPLETE PROGRAM INCLUDED WITH COMMENTS AND SCREENSHOT OF OUTPUT .

steps

Step by step

Solved in 5 steps with 1 images

Blurred answer
Similar questions
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