Question: The following is a program with a decision structure in JAVA: At the end there are five questions with different values of a b and

The following is a program with a decision structure in JAVA: At the end there are five questions with different values of a b and c. For each set of values of a b and c please write what the program output would be.

//Determines the type of trainagles where a, b and c are angles.

public void triangleType( int a, int b, int c)

{

if( a == b )

{

if( b == c )

System.out.println ("Its an equilateral triangle");

else

System.out.println "Its an isosceles triangle a=b" );

}

else

{

if( c == b )

System.out.println (Its an isosceles triangle b = c" );

else if ( c == a )

System.out.println (Its an isosceles triangle a = c" );

else

System.out.println (Its just a triangle" );

}

if( ( a > b ) && ( a > c ) )

{

System.out.println (Largest Angle a " );

if ( a == 90 )

System.out.println (Right Angled triangle at a" );

else if ( a > 90 )

System.out.println (Obtuse Angle Triangle" );

else

System.out.println (Acute an gle Triangle" );

}

else if( (b > a) && ( b > c ) )

{

System.out.println ("Largest Angle b " );

if (b == 90 )

System.out.println ("Right Angled triangle at b" );

else if( b > 90 )

System.out.println ("Obtuse Angle Triangle" );

else

System.out.println ("Acute angle Triangle" );

}

else if ( (c > b) && ( c > a ) )

{

System.out.println ("Largest Angle c " );

if ( c == 90 )

System.out.println ("Right Angled triangle at c" );

else if ( c > 90 )

System.out.println ("Obtuse Angle Triangle" );

else

System.out.println ("Acute angle Triangle" );

}

return 0;

}

Show the output that would result from each of the following possible values for a,b and c.:

a) 1) a=60 b=60 c=60

b) 2) a=45 b=90 c=45

c) 3) a=30 b=60 c=90

d) 4) a=55 b=60 c=65

e) 5) a=110 b=35 c=35

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!