Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created May 16, 2021 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/7fbe648209dc61e811c0f7449bc599d8 to your computer and use it in GitHub Desktop.
Save parzibyte/7fbe648209dc61e811c0f7449bc599d8 to your computer and use it in GitHub Desktop.
<?php
# https://parzibyte.me/blog
echo "1. Operativo\n2. Administrativo\n3. Ejecutivo\nSeleccione tipo de empleado: ";
fscanf(STDIN, "%d", $tipoEmpleado);
if ($tipoEmpleado < 1 || $tipoEmpleado > 3) {
exit("Tipo de empleado inválido");
}
echo "Ingrese la cantidad de horas trabajadas: ";
fscanf(STDIN, "%d", $horas);
switch ($tipoEmpleado) {
case 1:
$salario = 5.5 * $horas;
break;
case 2:
$salario = 10 * $horas;
break;
case 3:
$salario = 18.5 * $horas;
break;
}
echo "Su salario para esta quincena es: " . $salario . " dólares";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment