Last active
February 17, 2016 01:05
-
-
Save gutomcosta/97e9325c54f060bd7ef9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Veiculo { | |
private double capacidadeDoTanque; | |
private double quantidadeCombustivel; | |
public boolean tanquePossuiEspacoDisponivel(double litros){ | |
return this.capacidadeDoTanque > (this.quantidadeDeCombustivel + litros); | |
} | |
public void encherOTanque(double litros){ | |
if (! this.tanquePossuiEspacoDisponivel(litros)) new VeiculoComTanqueCheioException(.....); | |
this.quantidadeCombustivel += litros; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment