
CASE CON IF ANIDADO NO RECONOCE LOS VALORES DEL IF CUANDO AGREGO OTROS
Publicado por MANIGOLDO (1 intervención) el 21/01/2018 06:25:08
HOLA amigos mi problema es que cuando le doy mas opciones al IF este no reconoce los nuevos valores, por favor ayudenme
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
<?php
class Simulador
{
private $monto = 0;
private $plazo = 0;
private $trea = 0;
public function __construct($monto, $plazo)
{
$this->monto = $monto;
$this->plazo = $plazo;
$this->calcularTrea();
}
/**
* Permite retornar la trea de acuerdo al plazo y monto
*
* @return integer
*/
private function calcularTrea()
{
switch ($this->monto) {
case (($this->monto >= 500) && ($this->monto <= 10000)):
if ($this->plazo >= 90 && $this->plazo <= 180) {
$this->trea = 5.0;
} else if ($this->plazo >= 181 && $this->plazo <= 360) {
$this->trea = 8.0;
} else if ($this->plazo >= 361 && $this->plazo <= 540) {
$this->trea = 10.0;
} else if ($this->plazo >= 541) {
$this->trea = 11.0;
} else {
$this->trea = 0;
}
break;
case (($this->monto >= 10001) && ($this->monto <= 20000)):
if ($this->plazo >= 90 && $this->plazo <= 180) {
$this->trea = 6.0;
} else if ($this->plazo >= 181 && $this->plazo <= 360) {
$this->trea = 9.0;
} else if ($this->plazo >= 361 && $this->plazo <= 540) {
$this->trea = 10.5;
} else if ($this->plazo >= 541) {
$this->trea = 11.5;
} else {
$this->trea = 0;
}
break;
case (($this->monto >= 20001) && ($this->monto <= 30000)):
if ($this->plazo >= 90 && $this->plazo <= 180) {
$this->trea = 7.0;
} else if ($this->plazo >= 181 && $this->plazo <= 360) {
$this->trea = 10.0;
} else if ($this->plazo >= 361 && $this->plazo <= 540) {
$this->trea = 11.0;
} else if ($this->plazo >= 541) {
$this->trea = 12.0;
} else {
$this->trea = 0;
}
break;
case ($this->monto >= 30001):
if ($this->plazo >= 90 && $this->plazo <= 180) {
$this->trea = 8.0;
} else if ($this->plazo >= 181 && $this->plazo <= 360) {
$this->trea = 11.0;
} else if ($this->plazo >= 361 && $this->plazo <= 540) {
$this->trea = 12.5;
} else if ($this->plazo >= 541) {
$this->trea = 13.0;
} else {
$this->trea = 0;
}
break;
default:
$this->trea = 0;
break;
}
}
Valora esta pregunta


0