Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ language, I'm stuck at a few parts and don't know how to approach them class Triangle : public triangleInterface { private : T side1,
C++ language, I'm stuck at a few parts and don't know how to approach them class Triangle : public triangleInterface{ private : T side1, side2, side3; public : Triangle(); Triangle(T side1, T side2, T side3); /** Sets or modifies the sides of this triangle. Ensures that the new sides form a triangle. */ void setSides(T newSide1, T newSide2, T newSide3) override ; /** Gets the three sides of this triangle. * @return A vector containing the values of the sides. */ std::vector getSides() const override; /** Computes the area of this triangle. @return This triangle's area. */ T getArea() const override; /** Computes the perimeter of this triangle. @return This triangle's perimeter. */ T getPerimeter() const override; /** @return True if this triangle is a right triangle. */ bool isRightTriangle() const override; /** @return True if this triangle is an equilateral triangle. */ bool isEquilateral() const override; /** @return True if this triangle is an isosceles triangle. */ bool isIsosceles() const override; }; template<class T> Triangle ::Triangle() { //TODO } template <class T> Triangle ::Triangle(T side1, T side2, T side3) { //TODO } template <class T> void Triangle ::setSides(T newSide1, T newSide2, T newSide3) { //TODO } /** Gets the three sides of this triangle. * @return A vector containing the values of the sides. */ template <class T> std::vector Triangle ::getSides() const { //TODO } /** Computes the area of this triangle. @return This triangle's area. */ template <class T> T Triangle ::getArea() const{ //heron's formula triangle area //TODO } /** Computes the perimeter of this triangle. @return This triangle's perimeter. */ template <class T> T Triangle ::getPerimeter() const { //TODO } /** @return True if this triangle is a right triangle. */ template <class T> bool Triangle ::isRightTriangle() const { //TODO } /** @return True if this triangle is an equilateral triangle. */ template <class T> bool Triangle ::isEquilateral() const { //TODO } /** @return True if this triangle is an isosceles triangle. */ template <class T> bool Triangle ::isIsosceles() const { //TODO }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started