wes d2a2ba9e15 first commit 4 éve
..
README.md d2a2ba9e15 first commit 4 éve
code.cpp d2a2ba9e15 first commit 4 éve
unitTest.cpp d2a2ba9e15 first commit 4 éve

README.md

Make a Circle with OOP

by Alex Golubov tags: objects, classes, math

Summary

Your task is to create a Circle constructor that creates a circle with a radius provided by an argument. The circles constructed must have two getters getArea() (PIr^2) and getPerimeter() (2PI*r) which give both respective areas and perimeter (circumference). For help with this class, I have provided you with a Rectangle constructor which you can use as a ba

Instructions

Your task is to create a Circle constructor that creates a circle with a radius provided by an argument. The circles constructed must have two getters getArea() (PI*r^2) and getPerimeter() (2*PI*r) which give both respective areas and perimeter (circumference).

For help with this class, I have provided you with a Rectangle constructor which you can use as a base example.

Examples

Circle circy(11);
circy.getArea();

// Should return 379.94

Circle circy(4.44);
circy.getPerimeter();

// Should return 27.8832

Notes

Don't worry about floating point precision - I've factored in the chance that your answer may be more or less accurate than mine. This is more of a tutorial than a challenge so the topic covered may be considered advanced, yet the challenge is more simple - so if this challenge gets labelled as easy, don't worry too much.