Skip to content

Instantly share code, notes, and snippets.

@gutomcosta
Last active February 17, 2016 01:05
Show Gist options
  • Save gutomcosta/97e9325c54f060bd7ef9 to your computer and use it in GitHub Desktop.
Save gutomcosta/97e9325c54f060bd7ef9 to your computer and use it in GitHub Desktop.
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