1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
GuDViN [60]
2 years ago
11

Question: 4/8

Computers and Technology
1 answer:
Gemiola [76]2 years ago
8 0

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

You might be interested in
In public-key encryption, the two keys–one for coding and one for decoding–are known as ________.
Feliz [49]
Public key and private key  - In public key encryption, a pair of keys is used (public key and private key). The public key can be made available publicly, while the private key is only known  by the owner. The public key is used to encrypt the message, while the private key is used to decrypt the message.
5 0
3 years ago
Select all that apply.
Nat2105 [25]

Answer:

  • Inserting headers or footers
  • Inserting a watermark

Explanation:

A Master Page is a page which can be used with the majority of the documents of your paper as a reference. Master pages may have visuals elements, such as headlines, footers, column headings, etc that occur on all publishing pages.

7 0
3 years ago
Which statement will you use to create a scanner object scan to read input from the keyboard
vlabodo [156]

Answer:

<em><u>To create a Scanner object, you use the new keyword. To create a Scanner object that gets input from the keyboard, specify System.in in the parentheses. To use one of the methods of a Scanner object, code the object name, a dot (period), the method name, and a set of parentheses.</u></em>

8 0
3 years ago
An independent penetration testing company is invited to test a company's legacy banking application developed for Android phone
erastovalidia [21]

2010s is the one who created the iPhone

8 0
3 years ago
It is the job of the _____ to convert between 8-bit-wide digital data and 1-bit-wide digital data.
suter [353]
Multiplexer. A mux converts mutiple inputs into fewer outputs, for example combined with an address bus. Then the address bus decides which part of the input is linked to the output, so the inputs use the outputs each at a different point in time (=time division multiplexing)
3 0
4 years ago
Other questions:
  • The collection of programs on a computer is referred to as _______________.​
    14·1 answer
  • Which of the following might be ways to reduce cognitive overload? Select all that apply
    5·1 answer
  • A classmate is texting a false rumor around school that another student was arrested for shoplifting. This behavior can be descr
    9·2 answers
  • (word excel)
    15·1 answer
  • Which statement is false? Select one: a. A class is to an object as a blueprint is to a house. b. Classes are reusable software
    5·1 answer
  • In this​ video, Samir describes how business executives use a BI application to drill down and see​ _____ data, the detail in th
    7·1 answer
  • Suppose that L is a sorted list of 1,000,000 elements. To determine whether the x item is in L, the average number of comparison
    14·1 answer
  • Who invite computer ?​
    7·2 answers
  • Explain the procedure you will undertake to create a new partition​
    6·1 answer
  • One of the difficult things about working in game design is that while there are many different roles, most of them only match o
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!