angel brown This is part 1 of the Scala “tutorial”: class

Transcrição

angel brown This is part 1 of the Scala “tutorial”: class
angel brown
This is part 1 of the Scala “tutorial”:
class RationalNumber(numerator: Int, denominator: Int)
{
private def num() = numerator
private def den() = denominator
override def toString =
num + "/" + den
def gcd (one: Int, two: Int): Int = {
if (one==0) two
else gcd(two, one%two)
}
def setNum: Int = {
num/gcd(num, den)
}
def setDen: Int = {
den/gcd(num, den)
}
}

Documentos relacionados

FORMATAÇÃO teste

FORMATAÇÃO teste u.senha = request.getParameter("senha"); u.telefone = request.getParameter("telefone"); //Exibe no console a senha recebida System.out.println("Senha recebida:" + u.senha); //Substituo a senha sem ...

Leia mais