-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathCuentaCorriente.js
50 lines (42 loc) · 1 KB
/
CuentaCorriente.js
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
import { Cliente } from "./Cliente.js";
export class CuentaCorriente
{
#cliente;
numero;
agencia;
#saldo;
static cantidadCuentas = 0;
set cliente(valor) {
if (valor instanceof Cliente)
this.#cliente = valor;
}
get cliente() {
return this.#cliente;
}
constructor(cliente, numero, agencia) {
this.cliente = cliente;
this.numero = numero;
this.agencia = agencia;
this.#saldo = 0;
CuentaCorriente.cantidadCuentas++;
}
depositoEnCuenta(valor) {
if (valor > 0)
this.#saldo += valor;
return this.#saldo;
}
retirarDeCuenta(valor) {
if (valor <= this.#saldo)
this.#saldo -= valor;
return this.#saldo;
}
verSaldo() {
return this.#saldo;
}
transferirParaCuenta(valor,cuentaDestino) {
this.retirarDeCuenta(valor);
cuentaDestino.depositoEnCuenta(valor);
valor = 200;
valor = valor*1000;
}
}