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
What is an identifier? Give an example of an identifier.
ser-zykov [4K]

Explanation:

An identifier is the name of a program or the names of the variables, classes, methods, namespaces or interfaces within a program that are used to identify the relevant data/info.

Typically, identifiers must start with a letter (no numbers) and must not have any spaces in them, it should indicate the meaning and usage of the element being referred and i  t cannot have more than 511 characters.

An example is:

<em>int money; </em>

<em>double accountBalance;</em>

Where money and accountBalance are the identifiers.

I hope you find this information useful and interesting! Good luck!

7 0
3 years ago
Robin maintains a web page for updating the metro timings in the city. He would like the website to display the present day's sc
Paladinen [302]
The answer : B 4 is the value of the month that will be displayed on the web page
8 0
4 years ago
What TYPE of flash drive is called when it saves your files safely? I'm going to use my friend computer that's why.
Lilit [14]

Answer:

A good Universal serial bus i use is a San Disk

Explanation:

others are a WD easystore, A samsung MUF-BA.... etc

8 0
3 years ago
What three characteristics of a function are described in an IPO chart? What is performed at each characteristic?
Blizzard [7]

Answer:

Input

Processing

Output

Explanation:

6 0
3 years ago
What determines the keystroke to open a cmos editor? how can you find this information?
Brums [2.3K]
<span>Determining the keystrokes of opening the cmos editor depends on the ram contained in the parameters in BIOS.It can be a very daunting task however made more accessible by instructions detailed in various ways by others.Research is needed.</span>
3 0
3 years ago
Other questions:
  • Put the following five steps in the order in which you would perform them to use the Paste Special function: ____. 1. Select and
    5·1 answer
  • A url consists of a ____, a domain name, sometimes the path to a specific web page or location in a web page, and the web page n
    11·1 answer
  • The PATH environment variable.
    5·1 answer
  • A network administrator recently implemented two caching proxy servers on the network. how can the administrator best aggregate
    5·1 answer
  • What are the differences in LAN and WAN and how they are used to Increase Cybersecurity
    7·1 answer
  • A packet analyzer is a program that can enable a hacker to do all of the following EXCEPT ________. Select one: A. assume your i
    6·1 answer
  • Write a function solution that, given an array A consisting of N integers, returns the number of fragements of A whose sum equal
    9·1 answer
  • What are the 5 font/typography families
    14·1 answer
  • Another way to create a new presentation is from the Home tab
    6·2 answers
  • Can someone help me debug this please
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!