-
Lenguaje
PHP
-
Descripción
A un trabajador le pagan según sus horas trabajadas y las horas extras. Si la cantidad de horas trabajadas es mayor a 54 horas quiere decir que trabajó horas extras, las horas extras incrementan en un 50% de la hora normal. Calcular el salario del trabajador dadas horas trabajadas y el valor por hora.
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
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Salario de un trabajador</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php
<html>
<head>
<title>Salario de un trabajador</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
if ($_SERVER['REQUEST_METHOD']=='POST')
{
$horas_trabajadas = floatval ($_POST['horas_trabajadas']);
$pago_por_hora = floatval ($_POST['pago_por_hora']);
$salario_del_trabajador=$horas_trabajadas*$pago_por_hora;
if($horas_trabajadas>54)
$salario_del_trabajador=$salario_del_trabajador+($horas_trabajadas-54)*$pago_por_hora*0.5;
echo 'Valor de salario del trabajador: ' . $salario_del_trabajador . "<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="horas_trabajadas">Ingresa el valor de horas trabajadas:</label>
</td>
<td>
<input name="horas_trabajadas" required="required" step="0.000001" type="number" />
</td>
</tr>
<tr>
<td>
<label for="pago_por_hora">Ingresa el valor de pago por hora:</label>
</td>
<td>
<input name="pago_por_hora" required="required" step="0.000001" type="number" />
</td>
</tr>
<tr align="center">
<td colspan="2" rowspan="1">
<input value="Procesar" type="submit" />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
<table style="text-align: left; margin-left: auto; margin-right: auto;" border="1" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td>
<label for="horas_trabajadas">Ingresa el valor de horas trabajadas:</label>
</td>
<td>
<input name="horas_trabajadas" required="required" step="0.000001" type="number" />
</td>
</tr>
<tr>
<td>
<label for="pago_por_hora">Ingresa el valor de pago por hora:</label>
</td>
<td>
<input name="pago_por_hora" required="required" step="0.000001" type="number" />
</td>
</tr>
<tr align="center">
<td colspan="2" rowspan="1">
<input value="Procesar" type="submit" />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>