Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/herencia/enums/Banco.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package herencia.enums;

/**
*
* @author Aula
*/
public class Banco {
public static void main(String[] args) {
CuentaBancaria cb = new CuentaBancaria(1, "Maria", TipoCuenta.VIP);
System.out.println("Tasa: "+cb.tasa());

System.out.println("El saldo de Maria es: " + cb.getSaldo());
}
}
14 changes: 5 additions & 9 deletions src/herencia/enums/CuentaBancaria.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package herencia.enums;

/**
*
* @author Aula
*/
public class CuentaBancaria {
private int cod;
private String cliente;
Expand All @@ -35,4 +27,8 @@ public double tasa(){
}*/
return tipo.tasa;
}

public double getSaldo() {
return tipo.saldo;
}
}
16 changes: 5 additions & 11 deletions src/herencia/enums/TipoCuenta.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package herencia.enums;

/**
*
* @author Aula
*/
public enum TipoCuenta {
AHORRO(0.02), CHEQUES(0), PLAZOFIJO(0.08), VIP(0.05);
AHORRO(0.02, 1000), CHEQUES(0, 7000), PLAZOFIJO(0.08, 1000000), VIP(0.05, 10000);

public final double tasa;
public final double saldo;

private TipoCuenta(double t){
private TipoCuenta(double t, double s){
tasa = t;
saldo = s;
}
}