Skip to content

Instantly share code, notes, and snippets.

@reu
Created February 24, 2011 23:46
Show Gist options
  • Save reu/843151 to your computer and use it in GitHub Desktop.
Save reu/843151 to your computer and use it in GitHub Desktop.
abstract public class Cliente {
protected double saldo;
public Cliente(float saldo){
this.saldo = saldo;
}
public void depositar(float valor){
this.saldo = this.saldo + valor;
}
public double obterSaldo(){
return this.saldo;
}
public void sacar(float valor){
this.saldo = this.saldo - (valor * this.taxa());
}
abstract protected double taxa();
}
public class ClienteComum extends Cliente {
public ClienteComum(float saldo){
super(saldo);
}
protected double taxa() {
return 1.005;
}
}
public class ClienteEspecial extends Cliente {
public ClienteEspecial(float saldo){
super(saldo);
}
protected double taxa() {
return 1.001;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment