-
-
Save hirayGui/24b06d9cf3271adfbe7b1e720d3ae3ca to your computer and use it in GitHub Desktop.
Exemplo: Classe conta
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
package banco; | |
public abstract class Conta { | |
private float saldo; | |
protected void setSaldo(float valor) { | |
this.saldo = valor; | |
} | |
public float getSaldo() { | |
return this.saldo; | |
} | |
public abstract void depositar(float valor); | |
public abstract void retirar(float valor); | |
public void transferirPara(Conta outraConta, float valor) throws Exception { | |
this.retirar(valor); | |
outraConta.depositar(valor); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment