Created
May 6, 2020 18:54
-
-
Save pppillai/37c6fa8f0a387a9d3c68f0a165b04a0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(second). | |
-import(first, [squareValue/1]). | |
-export([sizeOfHypotenuse/2, perimeterOfRightAngledTriangle/2, areaOfTriangle/2]). | |
%%below functions to be used for right angled triangle | |
%returns the hypotenuse | |
sizeOfHypotenuse(SideOne, SideTwo) -> | |
math:sqrt(squareValue(SideOne) + squareValue(SideTwo)). | |
%returns the perimeter | |
perimeterOfRightAngledTriangle(SideOne, SideTwo) -> | |
SideOne + SideTwo + sizeOfHypotenuse(SideOne, SideTwo). | |
%returns the area | |
areaOfTriangle(SideOne, SideTwo) -> | |
0.5 * SideOne * SideTwo. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice one! Declarative names FTW!
Tip: In Erlang it's more idiomatic to use snake_case for function names, module names and atoms in general, instead of pascalCase.