Question: I have all this code, except the only part I can't get to compile is the perimeter = A.distance(B) + B.distance(C) + C.distance(A); gives me

I have all this code, except the only part I can't get to compile is the perimeter = A.distance(B) + B.distance(C) + C.distance(A);

gives me the error "class point doesn't have member distance"

#include #include

class Point { private: int x; int y;

public: Point() { x = 0; y = 0; }

Point(int x, int y) { this->x = x; this->y = y; }

int getX() { return x; }

int getY() { return y; }

void setX(int x) { this->x = x; }

void setY(int y) { this->y = y; } };

class Triangle { private: Point A; Point B; Point C; Point distance; double area; double perimeter;

public: Triangle(Point A, Point B, Point C) { this->A = A; this->B = B; this->C = C; area = 0.5 * abs((B.getX() - A.getX()) * (C.getY() - A.getY()) - (C.getX() - A.getX()) * (B.getY() - A.getY())); perimeter = A.distance(B) + B.distance(C) + C.distance(A); }

double getArea() { return area; }

double getPerimeter() { return perimeter; } };

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!