Advertisement
LEANDRONIEVA

PC-tp1cuentasueldo

Aug 27th, 2023
1,328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.86 KB | None | 0 0
  1. public class CuentaSueldo extends Cuenta implements IOperacionesComunes{
  2.  
  3.     private final static double tope = 15000;
  4.  
  5.     private int legajo;
  6.     private String institución;
  7.     private String beneficios;
  8.     private long cbu;
  9.    
  10.     public CuentaSueldo() {
  11.     }
  12.  
  13.     public CuentaSueldo(long cbu) {
  14.        
  15.         this.cbu = cbu;
  16.     }
  17.    
  18.     public void setLegajo(int nro) {
  19.         this.legajo = nro;
  20.     }
  21.  
  22.     public void setInstitucion(String entrada) {
  23.         this.institución = entrada;
  24.     }
  25.    
  26.     public void setBeneficios(String entrada) {
  27.         this.beneficios = entrada;
  28.     }
  29.  
  30.     @Override
  31.     public void retirar(double cantidad) {
  32.         if(cantidad>this.saldo) {
  33.             System.out.println("Su saldo es insuficiente");
  34.         }else {
  35.             if(cantidad>tope) {
  36.                 System.out.println("El tope de extracción es $"+tope);
  37.             }else{
  38.                 this.saldo -= cantidad;
  39.                 System.out.println("Se retiró $"+cantidad);
  40.             }
  41.         }
  42.     }
  43.  
  44.     @Override
  45.     public String toString() {
  46.         return "CuentaSueldo [Nro=" + Nro + ", Dni=" + Dni + ", saldo=" + saldo + ", interes=" + interes +", legajo=" + legajo + ", institución=" + institución + ", beneficios=" + beneficios
  47.                 + ", cbu=" + cbu + "]";
  48.     }
  49.  
  50.     public void transferir(double monto, long cbu){
  51.         if(this.saldo>=monto) {
  52.             this.saldo -= monto;
  53.             System.out.println("Tranferencia de $"+monto+" exitosa");
  54.         }else {
  55.             System.out.println("Fondos insuficientes");
  56.         }
  57.     }
  58.    
  59.     public void transferir(double cantidad, String alias){
  60.         if(this.saldo>=cantidad) {
  61.             this.saldo -= cantidad;
  62.             System.out.println("Tranferencia de $"+cantidad+" exitosa");
  63.         }else {
  64.             System.out.println("Fondos insuficientes");
  65.         }
  66.     }
  67.  
  68.     @Override
  69.     public void addBeneficios(String beneficio) {
  70.         // TODO Auto-generated method stub
  71.         this.beneficios += " "+beneficio;
  72.        
  73.     }
  74.  
  75.     @Override
  76.     public void modificarCBU(long nuevo) {
  77.         // TODO Auto-generated method stub
  78.         this.cbu = nuevo;
  79.     }
  80. }
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement