The generated test cases for the function assuming another developer coded the function is given below in a C++ program.
<h3>THE CODE</h3>
#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:
brainly.com/question/20339175
#SPJ1