Get the answers you need at Westonci.ca, where our expert community is always ready to help with accurate information. Get precise and detailed answers to your questions from a knowledgeable community of experts on our Q&A platform. Our platform provides a seamless experience for finding reliable answers from a network of experienced professionals.

Question: 4/8
List all the tests that you would do in order to test the
isosceles function that receives as parameter the length of
the three sides of one triangle (integer numbers) and returns
one Boolean (true when the triangle is isosceles and false
either when it is not or when it is not possible to build a
triangle because of the lengths of the sides).
Test case example: islsosceles (3,2,3)--> TRUE. Keep the
same format for the proposed test cases.
Clarification: a triangle is isosceles when it has at least two
equal sides.


Sagot :

The generated test cases for the function assuming another developer coded the function is given below in a C++ program.

THE CODE

#include <iostream>  

#include <iomanip>

#include <string>

using namespace std;

// define the data type "triangletype" with {values}

enum triangleType { scalene, isosceles, equilateral, noTriangle };

// Prototype function which returns the position of triangleType{value}

// Example: Scalene = 0, isosceles = 1, etc. These are zero indexed.

triangleType triangleShape(double a, double b, double c);

// Prototype function which takes the integer value of the

// triangle type and outputs the name of triangle

string shapeAnswer(int value);

int main() {

   double inputA;

   double inputB;

   double inputC;

   cout << "To determine whether a triangle is either:" << endl;

   cout << setw(50) << " - Scalene" << endl; // Unequal in length

   cout << setw(52) << " - Isosceles" << endl; // Two sides equal length

   cout << setw(54) << " - Equilateral" << endl; // All sides equal

   cout << setw(57) << " - Not a triangle" << endl;

   cout << "Enter side A: ";

   cin >> inputA;

   cout << "Enter side B: ";

   cin >> inputB;

  cout << "Enter side C: ";

   cin >> inputC;

   cout << "The triangle is " << shapeAnswer(triangleShape(inputA, inputB, inputC)) << endl;

}

triangleType triangleShape(double a, double b, double c) {

   triangleType answer;

   if ( c >= (a + b) || b >= (a + c) || a >= (b + c) ) {

       answer = noTriangle;

   }

   else if (a == b && b == c) {

       answer = equilateral;

   }

   // Test the 3 options for Isosceles equality

   else if ( (a == b) && (a != c) || (b == c) && (b != a) || (a == c) && (a != b) ) {

       answer = isosceles;

   }

   else {

       answer = scalene;

   }

   return answer;

}

string shapeAnswer(int value) {

   string answer;

  switch (value) {

   case 0:

       answer = "Scalene";

       break;

   case 1:

       answer = "Isosceles";

       break;

   case 2:

       answer = "Equilateral";

       break;

   case 3:

       answer = "Not a triangle";

       break;

   default:

       break;

   }

   return answer;

}

Read more about C++ programs here:

https://brainly.com/question/20339175

#SPJ1