forked from tm-lopes/php-exerc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCorrente.php
More file actions
63 lines (32 loc) · 662 Bytes
/
Corrente.php
File metadata and controls
63 lines (32 loc) · 662 Bytes
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
<?php
class Corrente extends Conta
{
private $extrato;
public function __toString()
{
return "Conta Corrente";
}
public function __construct()
{
$this->extrato = array();
$this->saldo = 0.0;
}
public function sacar($valor)
{
$this->saldo = $this->saldo - $valor;
$this->registrarMovimentacao($valor);
}
public function depositar($valor)
{
$this->saldo = $this->saldo + $valor;
$this->registrarMovimentacao($valor);
}
private function registrarMovimentacao($valor)
{
$this->extrato[] = $valor;
}
public function extrato()
{
return implode($this->extrato , "\n");
}
}