Created
February 24, 2011 23:46
-
-
Save reu/843151 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
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