0% found this document useful (0 votes)
20 views2 pages

Triangle Assessment

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Triangle Assessment

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import [Link].

Scanner;

public class MjTriangle {


public static void main(String[] args) {

Scanner mj = new Scanner([Link]);

try {
[Link]("Enter the name of your triangle: ");
String name = [Link]();

[Link]("Enter the values of interior angle: ");


int a = [Link]();
int b = [Link]();
int c = [Link]();

[Link]("Angle #1 = " + a);


[Link]("Angle #2 = " + b);
[Link]("Angle #3 = " + c);

int sum = a + b + c;
boolean triangle = (sum == 180);

[Link](name + ": " + triangle);

int result = 180 - sum;


[Link]("Result = " + result);

boolean acute = false, obtuse = false, right = false;

if (triangle) {
if (a < 90 && b < 90 && c < 90) {
acute = true;
} else if (a == 90 || b == 90 || c == 90) {
right = true;
} else if (a > 90 || b > 90 || c > 90) {
obtuse = true;
}
}

[Link]("Acute: " + acute);


[Link]("Obtuse: " + obtuse);
[Link]("Right: " + right);

[Link]("Congratulations!");

}
catch(Exception e){
[Link]("INCORRECT INPUT!");
}

}
}

You might also like