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

1-a point in the x-y plane is represinted by it\'s x-coordinate and y-coordinate

ID: 3631881 • Letter: 1

Question

1-a point in the x-y plane is represinted by it's x-coordinate and y-coordinate. design aclass pointtype that can store and process apoint in the x-y plane . you should then perform operation on the point such as setting the coordinates of the point,printing the coordinates of the point,returning the x-coordinate, and returning the y-coordinate.also write aprogram to test various operation on the point.
2-every circle has acenter and a radius, given the radius , we can detremine the circle's area and circumference. given the center w 1- n determine its position in the x-y plane. the center of the circle is apoint in the x-y plane. design aclass circletype that can store the radius and center of the circle. because the center is apoint in the x-y plane and you designed the class to capture the properties of a point in programming exrcise 1, you must derive the class circletype from the class pointtype. you should be able to perform the usual operations on the circle such as setting the radius, calculating and printing the area and circumference, and carrying out the usual operations on the center, also write oprogram to test various operations on acircle.

Explanation / Answer

#ifndef pointType_H
#define pointType_H

class pointType
{
private:
int x;// x-coordinate
int y;// y-coordinate

public:
pointType(int=0, int=0);

void setX (int);
int getX();

void setY (int);
int getY ();

void print();

};

pointType::pointType(int xValue, int yValue)
{
x = xValue;
y = yValue;
}

void pointType::setX(int xValue) { x = xValue; }

int pointType::getX() { return x; }

void pointType::setY(int yValue) { y = yValue; }

int pointType::getY() { return y; }

void pointType::print() { cout<<"["<<x<<"."<<y<<"]"<<endl; }

#endif

#include <iostream.h>
#include "pointType.H"

class circleType : public pointType
{
private:
double r;

public:
circleType(double=0.0);

void setR(double);
double getR();

double getArea();
double getCircumference();

void print();

};

circleType::circleType(double radius) { r = radius; }

void circleType::setR(double radius) { r = (radius < 0.0 ? 0.0 : radius); }

double circleType::getR() { return r; }

double circleType::getArea() { return 3.14 * r * r; }
double circleType::getCircumference() { return 2 * r * 3.14; }

void circleType::print()
{
pointType::print();

cout<<" Radius of the circle is = "<<r<<endl;
cout<<" Area of the circle is = "<<circleType::getArea()<<endl;
cout<<" Circumference of the circle is = "<<circleType::getCircumference()<<endl;


}

int main()
{
circleType circle;

circle.setR(2.2);

circle.setX(7); // seeeeeeee here... i wana set X and Y from the main

circle.print();

return 0;
}