• Lenguaje

    PHP

  • Descripción

    Calcule el monto por impuesto predial. El impuesto dependerá del área que ocupa la casa (Ingresado por teclado), de los años de construcción y del material de construcción. Para calcular el impuesto debe considerarse el siguiente cuadro:

    AÑOS DE CONSTRUCCIÓN | IMPUESTO ($/M2)
    0 - 5 | 2.00
    6 -10 | 1.20
    11 - 15 | 0.85
    16 a más | 0.25

    De acuerdo al material de construcción el impuesto resultante aumentara en los porcentajes indicados:

    MATERIAL DE CONSTRUCCIÓN | AUMENTO (%)
    Concreto | 25
    Ladrillo | 12
    Adobe | 3

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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>Impuesto predial</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    <body>
<?php

if ($_SERVER['REQUEST_METHOD']=='POST')
{
    $anios_de_construccion = floatval ($_POST['anios_de_construccion']);
    $area = floatval ($_POST['area']);
    $material_de_construccion = intval ($_POST['material_de_construccion']);
    $impuesto=0;
    $aumento=0;
    if($anios_de_construccion<6)
        $impuesto=$area*2;
    if($anios_de_construccion>=6&&$anios_de_construccion<11)
        $impuesto=$area*1.2;
    if($anios_de_construccion>=11&&$anios_de_construccion<16)
        $impuesto=$area*0.85;
    if($anios_de_construccion>=16)
        $impuesto=$area*0.25;
    if($material_de_construccion==1)
        $aumento=$impuesto*0.25;
    if($material_de_construccion==2)
        $aumento=$impuesto*0.12;
    if($material_de_construccion==3)
        $aumento=$impuesto*0.03;
    $predial=$impuesto+$aumento;
    echo 'Valor de aumento: ' . $aumento . "<br/>\n";
    echo 'Valor de impuesto: ' . $impuesto . "<br/>\n";
    echo 'Valor de predial: ' . $predial . "<br/>\n";
}
 
?>
        <form method="post">
            <table style="text-align: left; margin-left: auto; margin-right: auto;" border="1" cellpadding="1" cellspacing="1">
                <tbody>
                    <tr>
                        <td>
                            <label for="anios_de_construccion">Ingresa el valor de anios de construccion:</label>
                        </td>
                        <td>
                            <input name="anios_de_construccion" required="required" step="0.000001" type="number" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="area">Ingresa el valor de area:</label>
                        </td>
                        <td>
                            <input name="area" required="required" step="0.000001" type="number" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="material_de_construccion">Selecciona el valor de material de construccion:</label>
                        </td>
                        <td>
                            <select name="material_de_construccion" required="required">
                                <option value="1">Concreto</option>
                                <option value="2">Ladrillo</option>
                                <option value="3">Adobe</option>
                            </select>
                        </td>
                    </tr>
                    <tr align="center">
                        <td colspan="2" rowspan="1">
                            <input value="Procesar" type="submit" />
                        </td>
                    </tr>
                </tbody>
            </table>
        </form>
    </body>
</html>