Created
October 5, 2016 00:03
-
-
Save cristiandley/8cffa2cc43f7d6329d5cdbe187259d2b to your computer and use it in GitHub Desktop.
pascal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program ejercicio12sept; | |
uses crt; | |
uses sysutils; | |
{ --------------------- DECLARACION ---------------------} | |
{resultados tabla categoria - cantidad - total sueldo} | |
var cant_a, cant_b, cant_c,total_a, total_b, total_c: integer; | |
{resultados tabla captication - cantidad - confirmado} | |
var conf_office, conf_tango, conf_redes: integer; | |
{resultado tabla edad por categoria suma y promedio} | |
var suma_a, suma_b, suma_c: integer; | |
var prom_a, prom_b, prom_c: real; | |
var confirmado: string; | |
var codigo: string; | |
var edad: integer; | |
begin | |
for i:=0 to 3 do | |
{variables temporales} | |
begin | |
confirmado:="D"; | |
codigo:="F"; | |
edad:=0; | |
{ --------------------- VALIDACION Y ASIGNACION ---------------------} | |
{lectura edad} | |
while (edad<76) and (edad>16) do | |
begin | |
writeln("Ingrese Edad"); | |
readln(edad); | |
end; | |
{lectura codigo} | |
while (lenght(codigo)<0) or not((codigo = "A") or (codigo = "B") or (codigo = "C")) do | |
begin | |
writeln("Ingrese Codigo"); | |
readln(codigo); | |
codigo:= UpperCase( codigo ); | |
end; | |
{lectura confirmado} | |
while (lenght(confirmado)<0) or not(confrimado = "SI") or (confirmado = "NO") do | |
begin | |
writeln("Ingrese Confirmado"); | |
readln(confirmado); | |
confirmado:= UpperCase(confirmado); | |
end; | |
case codigo of | |
"A" : begin | |
cant_a:= cant_a+1; | |
total_a:= total_a+17800; | |
suma_a:= suma_a+edad; | |
if confirmado="SI" then | |
conf_tango:= conf_tango+1; | |
end; | |
"B" : begin | |
cant_b:= cant_b+1; | |
total_b:= total_b+15300; | |
suma_b:= suma_b+edad; | |
if confirmado="SI" then | |
conf_office:= conf_office+1; | |
end; | |
"C" : begin | |
cant_c:= cant_c+1; | |
total_c:= total_c+19700; | |
suma_c:= suma_c+edad; | |
if confirmado="SI" then | |
conf_redes:= conf_redes+1; | |
end; | |
end; | |
{ verificar que existan asignaciones } | |
if cant_a>0 then | |
prom_a:= suma_a/cant_a; | |
if cant_b>0 then | |
prom_b:= suma_b/cant_b; | |
if cant_c>0 then | |
prom_c:= suma_c/cant_c; | |
{ --------------------- VALIDACION Y ASIGNACION ---------------------} | |
end; | |
writeln("RESULTADOS:"); | |
writeln("---------------------------------------------------"); | |
writeln("CATEGORIA A: ", cant_a, "| TOTAL SUELDO: ", total_a); | |
writeln("CATEGORIA B: ", cant_b, "| TOTAL SUELDO: ", total_b); | |
writeln("CATEGORIA C: ", cant_c, "| TOTAL SUELDO: ", total_c); | |
writeln("---------------------------------------------------"); | |
writeln("CAPACITACION TANGO: ", cant_a, "| CONFIRMADOS: ", conf_tango); | |
writeln("CAPACITACION OFFICE: ", cant_b, "| CONFIRMADOS: ", conf_office); | |
writeln("CAPACITACION REDES: ", cant_c, "| CONFIRMADOS: ", conf_redes); | |
writeln("---------------------------------------------------"); | |
writeln("EDAD A: ", suma_a, "| PROMEDIO: ", prom_a); | |
writeln("EDAD B: ", sum_b, "| PROMEDIO: ", prom_b); | |
writeln("EDAD C: ", sum_c, "| PROMEDIO: ", prom_c); | |
readln; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment