Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

What is dividend payout ratio ?

Answered: 1 week ago

Question

Explain the factors affecting dividend policy in detail.

Answered: 1 week ago