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
An attacker watches people as they enter a building requiring a key card. He waits until he sees someone who appears to be in a
Pie

being followed? im not sure of the professional term, if there even is one

5 0
4 years ago
It means fruit- trees garden.
Vikentia [17]

Answer:

What does?

Explanation:

Do you have a question?

4 0
3 years ago
Cabe participates in her employer’s PPO plan. Denzel participates in her employer’s HDHP plan. Neither have any medical expenses
denpristay [2]

Answer:

Coverage may be subject to annual deductible, copayment, and coinsurance ... participate with your health care providers in decisions about your treatment; ... privacy of medical and financial records maintained by the Plan, the Claims ... Annual Employer Contribution (HSA Benefit Dollars) . ... This is not a dental plan.

Explanation:

6 0
4 years ago
Read 2 more answers
Me Completan Pliiiis
Brut [27]
Can you translate please i’ll help better
4 0
3 years ago
____ allows someone browsing the internet to click on words or phrases, enter his or her phone number, and continue browsing
Sphinxa [80]
It is the internet callback technology that allows someone browsing the internet to click on words or phrases, enter his or her phone number, and continue browsing. It is a technology that enable one to browse the Internet to cue on a certain website to have a representative call a certain number.<span />
6 0
3 years ago
Read 2 more answers
Other questions:
  • What are 5 actions that you can do to take care of your camera
    14·2 answers
  • Colours in art packages are often given Hex codes as illustrated below with #00ccff. Why is Hex used in this way rather than the
    11·1 answer
  • All phones must have a way of making and then terminating a connection to the phone network; however the exact procedure for doi
    6·1 answer
  • 18. Which type of briefing is delivered to individual resources or crews who are assigned to operational tasks and/or work at or
    14·1 answer
  • Modify your solution to Problem 8.24 so that one (and only one) child installs a Segmentation-fault handler which prints an erro
    10·1 answer
  • Define the term unique key and give an example.
    6·1 answer
  • which of these variable declarations will the variable remain uninitialized unless it is explicitly initialized?1)Declaration of
    5·1 answer
  • Unlike radio frequency identification (RFID) tags, bar codes: Question 30 options: require a reader that tunes into a specific f
    14·1 answer
  • How do you believe cryptocurrency work shape the next 10 years
    6·1 answer
  • Alice has an item x and Bob has a set of five distinct items y1, y2, y3, y4 and y5. Design a protocol through which Alice (but n
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!