Last active
February 17, 2016 01:05
-
-
Save gutomcosta/5269d6c9a03d853493f3 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
class BombaDeCombustivel{ | |
private double quantidadeDeCombustivel; | |
public void abastecer(double litros, Veiculo veiculo){ | |
if (litros <= 0) new BombaDeCombustivelVaziaException(....); | |
if (! this.temCombustivelSuficiente(litros)) new QuantidadeInsuficienteException(....); | |
veiculo.encherOTanque(litros); | |
this.quantidadeDeCombustivel -= litros; | |
} | |
public boolean temCombustivelSuficiente(double litros){ | |
return this.quantidadeDeCombustivel >= litros; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment