Created
October 16, 2018 13:46
-
-
Save danielmoraisifsp/0f38eeddfb602ca4dc8e9610770ecc92 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