Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a circle class(circle.cpp). main.cpp circle.h Forthis homework you will h

ID: 3760064 • Letter: C

Question

Create a circle class(circle.cpp).

main.cpp

circle.h

Forthis homework you will hove to impenent a eircle" dlass You are given a main For this homework you will have to implement a "circle" class. You are given a main source file and the circle class definition file. The following members are part of the "circle" class. radius: radius of the circle circle): default constructor circle(float r): constructor which will set the radius circle(const circle &obj;): copy constructor void setRadius(float): method for setting radius float getRadius(void): Returns radius of circle float getArea(void): Returns area of circle float getCircumference(void): Returns circumference of circle Once you have implemented the circle class and all of its methods, the output of the main function should look like Area of c1: 12.5664 Circunference of c2: 25.1327 Radius of c3: 10 Radius of c4: 10 tin@tin-laptop:-/Dropbox/EGRE-246/spring_2014/assignnents/hw6s

Explanation / Answer

#include <iostream>
#include <math.j>
using namespace std;

class circle{
   public:
       circle(){
           radius = 0.0;
       }
       circle(float r){
           radius = r;
       }
       circle(const circle &obj){
           this.radius = obj.radius;
       }

       void setRadius(float r){
           radius = r;
       }
       float getRadius(){
           return radius;
       }

       float getArea(){
           return M_PI*radius*radius;
       }
       float getCircumference(){
           return 2*M_PI*radius;
       }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote