Extend the code from Lab5A. Use the same UML as below and make extensions as necessary Circle -int…

Extend the code from Lab5A. Use the same UML as below and make extensions as necessary


-int x //x coord of the center

-int y // y coord of the center

-int radius

-static int count // static variable to keep count of number of circles created

+ 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 center of the other circle lies inside this circle else returns false

+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

+getCount():int //returns the number of circles created

//note that the resize function is an overloaded function. The definitions have different signatures

  1. Write a brand new driver program that does the following:
  2. Creates a circle object circleOne at (0,0):5.
  3. Creates a pointer c1Ptr to circleOne
  4. Creates a circle object circleTwo at (-2,-2): 10
  5. Creates a pointer c2Ptr to circleTwo
  6. Use greaterThan to check if circleTwo is bigger than circleOne and display results
  7. Declare an array of pointers to circles- circlePointerArray
  8. Call a function with signature inputData(circlePointerArray, string filename) that reads data from a file called dataLab4.txt into the array The following h-k are done in this function
  9. Use istringstream to create an input string stream called instream. Initialize it with each string that is read from the data file using the getline method.
  10. Read the coordinates for the center and the radius from instream to create the circles
  11. Include a try catch statement to take care of the exception that would occur if there was a file open error. Display the message “File Open Error” and exit if the exception occurs
  12. Display all the circles in this array of pointers using the toString method
  13. Display the sum of the areas of all the circles in the array
  14. Switch the position of the second and fourth circles by swapping pointers to the circles
  15. Display this changed sequence of circles using toString method

int main(){

// #include

// declare two pointers to circles and create them using “new ” memory from the heap

Circle *One = new Circle(0,0,0); // new gets memory for the circle object from the heap. The circle object is constructed by calling the constructor Circle(0,0,0) and the address of this object is stored in the memory location called One.

Circle *Two = new Circle(1,1,1);

if (One->greaterThan(Two))

std::cout<<” Circle One is bigger “<<>


std::cout<<” Circle Two is bigger “<<>

// create an array of pointers to circles

Circle *circlePointerArray[SIZE];

//populate the pointer array with circles from the data file and return the number of circles created

int count = inputData(circlePointerArray, “dataLab4.txt”);

//rest of the code


**************** Static Function in Driver ************************

//pointer to pointer works

//Circle * circlePointer[] of course works

int inputData(Circle **circlePointerArray, string filename) // function header for inputting data from data file into Circle array

*****************Instance Method in Circle Class*********************

bool Circle::greaterThan(Circle * other){ // method that compares two circles using radius as key and

return this->radius > other->getRadius(); // returns true if “this circle” is greater than the “other circle”.

// Note the use of ->


Testing and Verification

Test your program thoroughly. Make sure that it compiles and runs correctly. I will be inspecting your code to make sure that it addresses the prompt correctly. So it is not sufficient for you to demonstrate that the output matches the required one.

Your output needs to look like this

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!