Package banco_imobiliario.model

Source Code of banco_imobiliario.model.Empresa

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package banco_imobiliario.model;

import banco_imobiliario.control.ControladorBancoImobiliario;

/**
*
* @author alessandro
*/
public class Empresa extends CasaDePropriedade {

    private int id;
    private int indiceMultiplicador;

    public Empresa() {
    }

    public Empresa(int indiceMultiplicador) {
        this.indiceMultiplicador = indiceMultiplicador;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getIndiceMultiplicador() {
        return indiceMultiplicador;
    }

    public void setIndiceMultiplicador(int indiceMultiplicador) {
        this.indiceMultiplicador = indiceMultiplicador;
    }

    public void debitarValor(Jogador jogadorDaRodada, double valor) {
        jogadorDaRodada.debitar(valor);
    }

    public void creditarValor(Jogador jogadorProprietário, double valor) {
        jogadorProprietário.creditar(valor);
    }

    public void pagarValor(Jogador jogadorDaRodada, Jogador jogadorProprietario, double valor) {
        if (jogadorDaRodada.debitar(valor)) {
            jogadorProprietario.creditar(valor);
        }
    }

    @Override
    public void atingida(Jogador jogador) {
        if (getProprietario() == null) {
            ControladorBancoImobiliario control = ControladorBancoImobiliario.getInstancia();
            control.comprarLogradouro(this);
        } else {
            pagarValor(getProprietario(), jogador, indiceMultiplicador * jogador.retornaValoresDados());
        }
        System.out.println("Casa em que caiu: " + this.getNome());
    }
}
TOP

Related Classes of banco_imobiliario.model.Empresa

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.