Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need some help! Please Please answer questions 1 5 , not just a program. thank

ID: 3627297 • Letter: I

Question

I need some help! Please

Please answer questions 1 5 , not just a program.

thanks

Question Details
In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sides. Stephanie has the integer lengths of three sides of a triangle and needs to know if it is a right triangle.

Write a program to solve this problem. NOTE: The user must be allowed to input the values of the sides in ANY ORDER!

1. Identify the inputs and outputs of the problem.


2. Identify the processing needed to convert the inputs to the outputs.


3. Design an algorithm in pseudocode to solve the problem. Make sure to include steps to get each input and to report each output.


4. Identify five significant test cases including one for incorrect input (ie. Input a letter rather than a digit for the numeric input). (Think about what impact changing the order of the input values should have on your program!) For each of the five test cases show what inputs you will use and calculate what your expected outputs should be.



5. Write the program to implement your algorithm. Test your program using your test cases.

Explanation / Answer

inputs are a, b, c in integers
outputs are true/false if it's a right triangle or not

c2 = a2 + b2 is the equation we're going to use and the only condition we have for that is that c be the largest number

#include
using namespace std;

bool isRight( int s1, int s2, int s3)
{
return((s3 * s3) == (s1 * s1 + s2 * s2));
}

int main()
{
int a, b, c, temp;
cout << "Enter the sides of the triangle separating each with a space: ";
cin >> a >> b >> c;

if(a > c && a > b)
{
temp = c;
c = a;
a = temp;
}
else if(b > c && b > a)
{
temp = c;
c = b;
b = temp;
}
if(isRight(a, b, c)) cout << " It is a right triangle ";
else cout << " It is not a right triangle ";
main();//take this out when you're done testing

system("pause");
return 0;
}