Given three sides of a triangle. Write the Program to
determine whether the triangle is :
1) Invalid
2) Right Angled
3) Isoscales
4) Equilateral
5) Not Special
An Isoscales right angled triangle should be taken as a
Right Angled Triangle
Answer Posted / ganesh bhat
I believe, this is more efficient one. solves all the cases.. comments please. Written in java
public static Map validateTriange(int a,int b,int c)
{
Map props = new HashMap();
boolean isValidTriangle;
int bigSide = a;
if(bigSide<b){bigSide = b;}
if(bigSide<c){bigSide = c;}
boolean isSpecial = false;
if((a+b+c-bigSide)>bigSide)
{
props.put("VALID","YES");
}
else
{
props.put("VALID","NO");
return props;
}
if(a == b||b==c||c == a)
{
props.put("ISOSCELES","YES");
isSpecial = true;
}
if(a == b && b == c)
{
props.put("EQUALATERAL","YES");
isSpecial = true;
}
if(((a*a+b*b+c*c)-bigSide*bigSide) == bigSide*bigSide)
{
props.put("RIGHT_ANGLED","YES");
isSpecial = true;
}
return props;
}
| Is This Answer Correct ? | 22 Yes | 22 No |
Post New Answer View All Answers
Explain with examples any 2 features of OOPS.
what is adodb??y it is used for connection of V.B and access??what is ado?dao?
I am looking for selenium RC online Training in chennai. can any one tell me the best institute
19. Given a system that is described with the following equation, X=A+(B.(A̅+C)+C)+A.B.(D̅+E̅) a) Simplify the equation using Boolean Algebra. b) Implement the original and then the simplified equation with a digital circuit. c) Implement the original and then the simplified equation in ladder logic.
what are the differences between CONS, LIST, and APPEND
in network security,how we identified threat?some one say we found threat according to it's signature,but how we get signature or pattern of the virus?
we create a pf with 3 fields.2 is defined as keyfields.we lock it with alcobj command.how we find out whether the file is locked or not?is it dspfd??/
What are events in smartforms?
Given: coordinates of rectangle-> left bottom and right top points. the rectangles create a hole.Find the maximum area of the hole. eg. 4 rectangles create a hole in between. find its area.
Do not use more than 3 nested IF. Use Evaluate statement in case of more IF required. Please give a detail explantion besides readability and clarity for Evaluate stmt.
what is integration testing in real time applications?
is it acceptable if we declare multiple exceptions in same overridden method.
How to get the index of the clicked field in reports in ABAP?
what is the work of 1tier,2tier,&ntier? Plz Explain it!
how much fee for deccan soft institute .how to block seat for sandeep sir class reply soonnnn