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
UkoKoshka [18]
3 years ago
10

The Classic Triangle Testing Problem, (Myer's Triangle): A program reads three integer values. The three values are interpreted

as representing the lengths of the sides of a triangle. The program prints a message that states whether the triangle is scalene, isosceles, or equilateral. Develop a set of test cases (at least 6 ) that you feel will adequately test this program. (This is a classic testing problem and you could find numerous explanations about it on the internet. I would recommend that you try to submit your own answer, based on your understanding of the topic)
Let’s define what the three different types of triangle requirements for the side’s lengths are:______.

Computers and Technology
1 answer:
Alex17521 [72]3 years ago
8 0

Answer:

Here is the Python program:

def MyersTriangle(a, b, c):  #method to test triangles

     

    if not(isinstance(a, int) and isinstance(b, int) and isinstance(c, int)):  #checks if values are of type int

         return 'Enter integer values'  

         

    elif a==0 or b==0 or c==0: #checks if any value is equal to 0

         return 'Enter integer values greater than 0'

         

    elif a<0 or b<0 or c <0:  #checks if any value is less than 0

         return 'All values must be positive'

         

    elif not (a+b>=c and b+c>=a and c+a>=b):  #checks if triangle is valid

         return 'Not a valid triangle'

         

    elif a == b == c:  #checks if triangle is equilateral

         return 'triangle is equilateral'

         

    elif a == b or b == c:  #checks if triangle is isoceles

         return 'triangle is isoceles'

         

    elif a != b and a != c and b != c:  #checks if triangle is scalene

         return 'triangle is scalene'        

#test cases

print(MyersTriangle(2.4,7.5,8.7))  

print(MyersTriangle(0,0,0))

print(MyersTriangle(-1,5,4))

print(MyersTriangle(10,10,25))

print(MyersTriangle(5,5,5))

print(MyersTriangle(3,3,4))

print(MyersTriangle(3,4,5))

   

Explanation:

The program uses if elif conditions to check:

if the values are integers: this is checked by using isinstance method that checks if values belongs to a particular int. If this returns true then values are integers otherwise not

if values are not 0: this is checked by using logical operator or between each variable which checks if any of the values is 0

if values are not negative: This is checked by using relational operator < which means the values are less than 0

if values make a valid triangle: this is checked by the rule that the sum of two sided of the triangle is greater than or equal to the third side.

and then checks if the triangle is scalene, isosceles, or equilateral: This is checked by the following rules:

For scalene all three sides are unequal in length

For isosceles any of the two sides are equal in length

For equilateral all sides should be equal in length.

The screenshot of the program along with the output is attached.

You might be interested in
Define a function PrintFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. Ex: PrintF
DaniilM [7]

Answer:

The function declaration to this question as follows:

Function declaration:

//declaring method printFeetInchShort, that accepts two integer parameters

void printFeetInchShort(int numFeet,int numInches) //method

{//method body

printf("The given height is: "); // message printing

printf("%d\'%d\" ", numFeet,numInches); //value printing

}

Explanation:

In the above method (function) declaration a method "printFeetInchShort" is declared, that accepts two integer variable as its parameters.

  • This method uses a return type void, which means it will not return any value.  
  • The parameter "numFeet and numInches" accepts an integer value in the main method and inside the method, it will print its value by a single and double quote.
5 0
3 years ago
Dustin is editing a SmartArt graphic. He wants all three shapes to be different colors.
lilavasa [31]

Answer:

click on Design tab → select associated shape → adjust color

Explanation:

I think it is that but i'm not positive. I will know in a little bit since I am taking the test right now.

6 0
4 years ago
What is the right thing to do when you spot fake news​
LUCKY_DIMON [66]

Answer:

to tell the truth

Explanation:

l mean there is no reason to keep it secret

6 0
3 years ago
All computers preform disk utilization the same software.<br> true or false
nikitadnepr [17]
"All computers preform disk utilization the same software "
This is false .
3 0
4 years ago
Read 2 more answers
Your laptop LCD panel is blank when you boot up. You can hear the laptop turn on, and the keyboard backlight is on. You have che
kati45 [8]

Answer:

Plug the laptop to a desktop monitor.

Explanation:

Assuming that the damaged component its the LCD screen and nothing else, the laptop would still be able to work correctly when connected to a desktop monitor, with an HDMI, or VGA cable. Thus you will find out that you only need to replace the screen and your graphic processor and other components are functional. Also if you need to work with your laptop and can't wait for the replacement, you can do still do it. Your keyboard and mouse are still functional, so you will see and work on your desktop monitor.

8 0
3 years ago
Other questions:
  • What operating system uses Fastboot?
    10·2 answers
  • What is most likely kept in as database
    15·1 answer
  • How to write an shortened if statement?
    6·1 answer
  • Atari licensed a game from taito that became a smash-hit and helped sell the vcs/2600. what is the name of that game?
    14·2 answers
  • You type a web address in your web browser. order the steps, which describe the internet name resolution process for the web add
    7·1 answer
  • Indicate the time efficiency classes of the three main operations (i.e., FindMax, DeleteMax, and Insert) of the priority queue i
    11·1 answer
  • What is the difference between Packaged and tailored soft ware?​
    6·1 answer
  • Any BTS army here
    6·2 answers
  • In the graph shown here, by what percentage are the number of people in computer occupations in general projected to increase?
    10·2 answers
  • Re-write the below program correcting the bugs
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!