Question: Consider a method with the following header: public static String triangleType(int a, int b, int c) This method will return a string value indicating the

Consider a method with the following header:

public static String triangleType(int a, int b, int c)

This method will return a string value indicating the type of triangle that results by having sides of length a, b and c. The possibilities are

  • "equilateral" (all 3 sides same length)
  • "isosceles" (2 sides same length, 3rd side different)
  • "scalene" (all sides have different length).

This method performs no input or output. That is, your code should have no statements containing next(), nextInt(), nextDouble(), print(), println() or printf().

Your answer should have the following format, where all comments currently shown are replaced by :

  • appropriate code
//1.Comments here should identify all preconditions // That is, what must be true about a, b, and c // Don't overlook the obvious, plus consider // the second bullet under Basic facts at smartconversion (Links to an external site.) // and/or // the Triangle Inequality Theorem at mathwarehouse (Links to an external site.). // //2. Comments here should identify the postconditions public static String triangleType(int a, int b, int c) { //3. Code here should throw an illegalArgumentException // with appropriate error message if any of the preconditions // are not met. //(2 pts)Code here should return the correct value }

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!