-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBancoTradicional.java
More file actions
95 lines (85 loc) · 2.75 KB
/
BancoTradicional.java
File metadata and controls
95 lines (85 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* 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 parcial;
public class BancoTradicional extends Banco {
private String direccion;
private String localidad;
private int cantidadDeCuentasEnDolares;
public BancoTradicional(String direccion, String localidad, String nombre, int cantidadDeEmpleados, int Ncuentas) {
super(nombre, cantidadDeEmpleados, Ncuentas);
this.direccion = direccion;
this.localidad = localidad;
this.cantidadDeCuentasEnDolares = 0;
}
public String getDireccion() {
return direccion;
}
public String getLocalidad() {
return localidad;
}
public int getCantidadDeCuentasEnDolares() {
return cantidadDeCuentasEnDolares;
}
@Override // comportamiento
public boolean agregarCuenta(Cuenta unaCuenta) {
boolean cumple = false;
if(this.cantidadDeCuentasEnDolares < 100){
super.addCuenta(unaCuenta);
cumple=true;
this.cantidadDeCuentasEnDolares++;
}
return cumple;
}
@Override // comportamiento
public String obtenerCuenta(String unCbu) {
String aux = " ";
int i=0;
boolean encontre = true;
while((i < super.getDl()) && (encontre)){
if(super.getCuentas()[i].getCbu().equals(unCbu)){
aux = super.getCuentas()[i].toString();
encontre = false;
}
i++;
}
return aux;
}
@Override // comportamiento
public boolean puedeRecibirTarjeta(String unCbu) {
int i=0;
boolean encontre = true;
boolean cumple = false;
while((i < super.getDl()) && (encontre)){
if(super.getCuentas()[i].getCbu().equals(unCbu)){
if (super.getCuentas()[i].getMoneda().equals("pesos")){
if(super.getCuentas()[i].getMonto() > 70000){
cumple= true;
encontre=false;
}
}else{
if(super.getCuentas()[i].getMonto() > 500){
cumple= true;
encontre= false;
}
}
}
i++;
}
return cumple;
}
@Override // comportamiento
public void depositarDinero(String unCbu, double unMonto) {
int i=0;
boolean encontre = true;
while((i < super.getDl()) && (encontre)){
if(super.getCuentas()[i].getCbu().equals(unCbu)){
super.getCuentas()[i].setMonto(unMonto);
encontre = false;
}
i++;
}
}
}