Write a class MyTriangle with two static methods:
isValid(double s1, double s2, double s3), returning true when the three lengths can form
a triangle (the sum of any two sides exceeds the third), and area(double s1, double s2, double s3), using Heron's formula √(s(s−a)(s−b)(s−c)) with s = (a+b+c)/2. The main
method reads three sides from the keyboard and prints the area with two decimal places, or a
message saying the input is invalid.
Problem
Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.
Model solution