id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

triangleClassification


A triangle is valid if the sum of any two sides is greater than the third side. Write a method, triangleClassification() that takes three int parameters, side1, side2 and side3 and returns a string value that classifies the triangle (so isosceles, equilateral, scalene or NOT a triangle). So, a+b > c and a+c > b and c+b > a must be true first to make sure it forms a triangle! Then classify.


triangleClassification(3, 5, 9) → "NOT a triangle"
triangleClassification(3, 3, 5) → "Isosceles"
triangleClassification(3, 4, 6) → "Scalene"

...Save, Compile, Run (ctrl-enter)

public String triangleClassification(int side1, int side2, int side3){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 100 Post-solution available

Copyright Nick Parlante 2017 - privacy