Practice-It! logo

BJP3 Exercise 4.12: printTriangleType

Added by: Kimberly Todd on 2013/04/01
Keywords: if/else, parameters

Write a method called printTriangleType that accepts three integer arguments representing the lengths of the sides of a triangle and prints what type of triangle it is. The three types are equilateral, isosceles, and scalene. An equilateral triangle has all three sides the same length, an isosceles triangle has two sides the same length, and a scalene triangle has three sides of different lengths. Here are some example calls to printTriangleType:

printTriangleType(5, 7, 7);
printTriangleType(6, 6, 6);
printTriangleType(5, 7, 8);
printTriangleType(12, 18, 12);

The output produced should be the following:


You must log in before you can solve this problem.

Log In

indent Re-indent

If you do not understand how to solve a problem or why your solution code doesn't work, please contact your TA or instructor.

If something seems wrong with the Practice-It system itself (errors, slow performance, incorrect problem descriptions/tests, etc.), please contact us.

Is there a problem?
Contact a Practice-It administrator.