Need help with this C++, I need to complete this include<iostream> using namespa
ID: 649519 • Letter: N
Question
Need help with this C++, I need to complete this
include<iostream>
using namespace std;
class Point {
private:
int xCord;
int yCord;
public:
Point (int =0, int =0); //constructor
void setData (int, int); //sets xCord and yCord
int getXCord(); //returns xCord
int getYCord(); //returns yCord
void display(); //prints to the screen XCord and YCord
};
//end class Point interface
//implementation of class Point function members
//your code
//###########A second class Circle derived from Point###
class Circle :
public Point //experiment with protected and private as Access specifiers
{
private: double radius;
public: Circle(int , int, double);
void setData(int, int, double); //sets xCord, yCord, and Radius
double getRadius(); //returns radius void display(); //prints to the screen xCord,yCord, and radius
double computeDiameter(); //returns the calculated circle diameter
double computeArea(); //returns the calculated circle area (pi*radius^2)
}//end class Point
/int main() {
//instantiate objects of types Point and Circle
//test different function calls
return 0;
}//end main
Any help would be greatly appreciated. Preferibly copy and pasted, not an image
Explanation / Answer
include<iostream>
using namespace std;
class Point
{
private:
int xCord;
int yCord;
public:
Point (int =0, int =0); //constructor
void setData (int, int); //sets xCord and yCord
int getXCord(); //returns xCord
int getYCord(); //returns yCord
void display(); //prints to the screen XCord and YCord
};
//end class Point interface
//implementation of class Point function members
//your code
//###########A second class Circle derived from Point###
class Circle: public point//experiment with protected and private as Access specifiers using single level inheritance
{
private:
double radius;
public:
Circle(int , int, double);
void setData(int, int, double); //sets xCord, yCord, and Radius
double getRadius(); //returns radius
void display(); //prints to the screen xCord,yCord, and radius
double computeDiameter(); //returns the calculated circle diameter
double computeArea(); //returns the calculated circle area (pi*radius^2)
} //end class Point
void main()
{
Clrscr();
Circle obj;// created circle class object
Obj.setData();
Obj.display();
Obj.computeDiameter();
Obj.computeArea();
getch();
//instantiate objects of types Point and Circle
//test different function calls
} //end main