Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Cuenta {
- private static long aux = 100001;
- protected long Nro = aux;
- protected long Dni;
- protected double saldo;
- protected double interes;
- public Cuenta() {
- super();
- aux++;
- }
- public Cuenta(long dni, double saldo, double interes) {
- super();
- Dni = dni;
- this.saldo = saldo;
- this.interes = interes;
- aux++;
- }
- public long getDni() {
- return Dni;
- }
- public void setDni(long dni) {
- Dni = dni;
- }
- public double getSaldo() {
- return saldo;
- }
- public void setSaldo(double saldo) {
- this.saldo = saldo;
- }
- public double getInteres() {
- return interes;
- }
- public void setInteres(double interes) {
- this.interes = interes;
- }
- public void actualizarSaldo() {
- this.saldo += (this.interes/365);
- }
- public void ingresar(double cantidad) {
- this.saldo+= cantidad;
- System.out.println("Se ingresó $"+cantidad);
- }
- public void retirar(double cantidad) {
- if(cantidad>this.saldo) {
- System.out.println("Su saldo es insuficiente");
- }else {
- this.saldo -= cantidad;
- System.out.println("Se retiró $"+cantidad);
- }
- }
- @Override
- public String toString() {
- return "Cuenta [Nro=" + Nro + ", Dni=" + Dni + ", saldo=" + saldo + ", interes=" + interes + "]";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement