Write a program that will determine the type of a triangle. It should take the lengths of the triangle's three sides as input, and return whether the triangle is equilateral, isosceles or scalene.
This app solves triangle problem using the length of 3 sides.
Input:
- The three sides of the triangle. Could be any number (decimal or integer) greater than zeros. It must respect the triangle inequality formula.
Output:
- The type of triangle (scalene, equilateral or isosceles) or the message detailing the problem with the input values.
To build this project:
mvn clean install
Run using Maven:
mvn exec:java -Dexec.mainClass="br.com.luizfeltes.triangle.cli.TriangleCLI" -Dexec.args="-sides a b c"
Where the values a, b and c are the sides of triangle. Example:
mvn exec:java -Dexec.mainClass="br.com.luizfeltes.triangle.cli.TriangleCLI" -Dexec.args="-sides 2 2 2"
Run using Maven to create the server:
mvn exec:java -Dexec.mainClass="br.com.luizfeltes.triangle.api.TriangleServer"
And make some calls using the web browser, using this url:
http://localhost:8080/triangle/type?a=X&b=Y&c=Z
Where the values X, Y and Z are the sides of triangle. Example:
http://localhost:8080/triangle/type?a=2&b=2&c=2
- Apache maven as a build tool
- Apache Commons CLI as a command line tool
- Jetty as a embedded http server
- Jersey to build the web service API
- JUnit as a unit testing tool