The absolute value function can be written as
follows in Cinnameg.
Define
case absolute(x) = x when x >= 0
case absolute(x) = -x
%Define
Convert that to an equivalent Java function definition. Assume
that x has type int. (Remember that Java
does not allow definition by cases. Instead, use an if-statement.