Subversion Repositories bacoAlunos

Rev

Rev 1505 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package pt.estgp.estgweb.domain;

/**
 * Created by jorgemachado on 07/09/16.
 */

public class EventFormacoesImpl extends EventFormacoes {

    private 1.5.0/docs/api/java/lang/Double.html">Double lucro = null;
    private 1.5.0/docs/api/java/lang/Boolean.html">Boolean rentavel = false;
    private 1.5.0/docs/api/java/lang/Double.html">Double percentagemLucro = 0.0;

    public double getLucroPrevisto()
    {
        if(lucro == null)
        {
            double entradas = getPrecoFormando() * getEventRecords().size();
            double custos = getCustoFormacao();
            lucro = entradas - custos;
            percentagemLucro = lucro <= 0 ? 0.0 : lucro/custos;
            if(percentagemLucro > getPercentagemMinimaLucro())
                rentavel = true;
        }
        return lucro;
    }
    public double getPercentagemLucro(){
        getLucroPrevisto();
        return percentagemLucro;
    }
    public boolean isRentavel(){
        getLucroPrevisto();
        return rentavel;
    }
}