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]
1 year ago
11

Question: 4/8

Computers and Technology
1 answer:
Gemiola [76]1 year 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
Write a function called countstuff () that takes as a parameter a character array, and returns an int. The prototype must be:
PSYCHO15rus [73]

Answer:

Please kindly go to the explanation part.

Explanation:

The required function is written in Raw code below.

Function:

#include<stdio.h>

#include<ctype.h> //including required libraries

int countstuff(char s[]){ //Function countstuff

int cntUp=0,cntLow =0,cntDigits = 0,i=0,value; //declaring required variables

for(i=0;s[i]!='\0';i++){ //loop to iterate over the characters of string

if(isupper(s[i])){

cntUp++; //incrementing count of uppercase if it is uppercase character

}

else if(islower(s[i])){

cntLow++; //incrementing count of lowercase if it is lowercase character

}

else if(isdigit(s[i])){

cntDigits++; //incrementing count of digits if it is digit

}

}

value = cntUp*1000000 + cntLow*1000 + cntDigits; //counting value using formula given in question

return value; //returning the value

}

void main(){

char string[1000]; //declaring required variables

int value;

printf("Enter a String:");

scanf("%[^\n]s",string); //taking string as input

value = countstuff(string); //calling function

printf("The Value is : %d\n",value); //printing result

}

5 0
2 years ago
What to do when microsoft word is eating your words?
Aloiza [94]
Update it so it wont do that
4 0
3 years ago
1. Very short questions.(any four) 14)<br>a. Write down the working principle of a computer.​
Oxana [17]

Answer:

The answer is below

Explanation:

Computer System is widely known for its ability to perform its functions faster by giving out information.

The computer system operation follows certain principles, some of which are:

1. It makes use of the OPERATING SYSTEM to link the hardware and the software together, without it, the computer system is useless.

2. It works with INPUT DEVICES such as keyboards or stylus. Without input devices, there is no way humans can communicate with the computer system

3. It works with OUTPUT DEVICES such as monitors and speakers. Without output devices, there is no way computers can communicate or give back information to humans.

4. It works with the NETWORK such as LAN or WIFI to provides the sharing of data files to other users or computers. Without the network, the computer system can only work within certain spaces, with no way to share data or files with others far away.

6 0
3 years ago
Explain the difference between "sleep mode" and "shutdown "
kari74 [83]

Answer:

When you shut down your electronic, all your open programs close and the electronic shuts down your operating system. An electronic that's shut down uses almost no power. In sleep mode, the electronic enters a low-power state. The electronics state is kept in memory.

5 0
2 years ago
12.
natali 33 [55]

Answer:

The answer is "Its fundamental economic structure of IP, which is based on the concept of incentives".

Explanation:

In the given question the correct choice is missing so, its solution can be defined as follows:

It is a copyrighted category that includes subjective human mind works. which exists in different forms, and also some countries recognize much more than others. Copyright laws, patents, trade secrets, and trademarks are the most famous types.  

  • This is a law that promotes the creation of a broad range of intellectual goods.
  • To do just that, the law gives the information and creative goods made, generally for a limited time, rights to individuals and companies.
7 0
3 years ago
Other questions:
  • Which cell formatting is most likely to use $?
    11·2 answers
  • Write the percentage 5 1/4 as a decimal​
    8·1 answer
  • A user wants to make sure he can quickly restore his computer after a drive failure to the state it was in when Windows and all
    9·1 answer
  • Why is formatting important with a table?
    12·1 answer
  • I need help with this work
    15·1 answer
  • Need the answer ASAP plz !!!!!
    7·1 answer
  • You are attempting to print a document from your workstation to the network printer in your office. The print job failed when yo
    14·1 answer
  • In this paper https://arxiv.org/pdf/2008.10150.pdf, I'm having a hard time understanding how the assignment in the picture is de
    10·2 answers
  • How to resize an image in photoshop without losing quality.
    11·1 answer
  • he attributes for an iframe are controlled by CSS. One of the iframe controls is "seamless." This means it _____. will blend the
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!