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

I want to create a class called triangle with 4 veribles: X1, X2, Y1, and Y2. An

ID: 3878604 • Letter: I

Question

I want to create a class called triangle with 4 veribles: X1, X2, Y1, and Y2. And it should display 1)) X1, X2,Y1, and Y2 . 2)) the name of the triangle. 3)) the peramter. 4)) calculate the area of the triangle. 5)) exits It should be in C++ I want to create a class called triangle with 4 veribles: X1, X2, Y1, and Y2. And it should display 1)) X1, X2,Y1, and Y2 . 2)) the name of the triangle. 3)) the peramter. 4)) calculate the area of the triangle. 5)) exits It should be in C++ It should be in C++

Explanation / Answer

#include<iostream>


class Triangle {
private:
   int x1, x2, y1, y2;

public:
   void printVariables() {
       cout << "x1: " << x1 << endl;
       cout << "x2: " << x2 << endl;
       cout << "y1: " << y1 << endl;
       cout << "y2: " << y2 << endl;
   }


   string getName() {
       if (y1 == y2 && y1 = 60)
           return "equilateral";
       else if (y1 == y2 && y1 != 60)
           return "isosceles";
       else if (x1 == x2)
           return "isosceles";
       else if (y1 == 90 || y2 == 90 || y1+y2 == 90
           return "right angled";
       else if (y1 > 90 || y2 > 90 || (y1 + y2) < 90)
           return "Obtuse Triangle";
       else
           return "Scalene Triangle";
   }

   double getArea() {
       return 0.5* x1 * x2;
   }

};

NOTE: Since you have not provided details of variables we are little confused and the solution might not be correct. In that case please comment below what changes you need, or define x1, x2, y1, y2. Once done, we shall update your answer in 6 hours. I hope you understand. Please cooperate.

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