-
Lenguaje
Pascal
-
Descripción
La oficina de tránsito solicita un programa que obtenga estadísticas de accidentes del mes pasado de las boletas de infracciones concentradas en el departamento, la multa por accidente e ingresos total por infracciones.
A) Porcentaje de accidentes ocasionados por mujeres.
B) Porcentaje de accidentes de otros municipios.
C) Porcentaje de accidentes en estado de ebriedad.
D) Porcentaje de conductores menores de edad.
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
program EstadisticasDeAccidentes;
uses crt;
var accidentes, edad, estado_conductor, municipio, sexo : integer;
var a, b, c, d : real;
var tecla_repetir : char;
begin
accidentes := 0;
a := 0;
b := 0;
c := 0;
d := 0;
repeat
clrscr;
write ('Ingresa el valor de edad: ');
readln (edad);
writeln ('Selecciona el valor de sexo.');
writeln (' 1.- Hombre');
writeln (' 2.- Mujer');
write (' : ');
repeat
readln (sexo);
if (sexo<1) or (sexo>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (sexo>=1) and (sexo<=2);
writeln ('Selecciona el valor de municipio.');
writeln (' 1.- Monterrey');
writeln (' 2.- San Nicol'#160's');
writeln (' 3.- Guadalupe');
writeln (' 4.- Santa Catarina');
writeln (' 5.- Escobedo');
writeln (' 6.- Otro');
write (' : ');
repeat
readln (municipio);
if (municipio<1) or (municipio>6) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (municipio>=1) and (municipio<=6);
writeln ('Selecciona el valor de estado conductor.');
writeln (' 1.- Ebrio');
writeln (' 2.- Sobrio');
write (' : ');
repeat
readln (estado_conductor);
if (estado_conductor<1) or (estado_conductor>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (estado_conductor>=1) and (estado_conductor<=2);
accidentes := accidentes+1;
if sexo=2 then
begin
a := a+1;
end;
if municipio=6 then
begin
b := b+1;
end;
if estado_conductor=1 then
begin
c := c+1;
end;
if edad<18 then
begin
d := d+1;
end;
writeln;
write (#168'Deseas repetir el proceso? (S/N): ');
repeat
tecla_repetir := readkey;
until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
if accidentes = 0 then
a := 0
else
a := 100.0*a/accidentes;
if accidentes = 0 then
b := 0
else
b := 100.0*b/accidentes;
if accidentes = 0 then
c := 0
else
c := 100.0*c/accidentes;
if accidentes = 0 then
d := 0
else
d := 100.0*d/accidentes;
writeln ('Valor de accidentes: ', accidentes);
writeln ('Valor de a: ', a:0:6);
writeln ('Valor de b: ', b:0:6);
writeln ('Valor de c: ', c:0:6);
writeln ('Valor de d: ', d:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var accidentes, edad, estado_conductor, municipio, sexo : integer;
var a, b, c, d : real;
var tecla_repetir : char;
begin
accidentes := 0;
a := 0;
b := 0;
c := 0;
d := 0;
repeat
clrscr;
write ('Ingresa el valor de edad: ');
readln (edad);
writeln ('Selecciona el valor de sexo.');
writeln (' 1.- Hombre');
writeln (' 2.- Mujer');
write (' : ');
repeat
readln (sexo);
if (sexo<1) or (sexo>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (sexo>=1) and (sexo<=2);
writeln ('Selecciona el valor de municipio.');
writeln (' 1.- Monterrey');
writeln (' 2.- San Nicol'#160's');
writeln (' 3.- Guadalupe');
writeln (' 4.- Santa Catarina');
writeln (' 5.- Escobedo');
writeln (' 6.- Otro');
write (' : ');
repeat
readln (municipio);
if (municipio<1) or (municipio>6) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (municipio>=1) and (municipio<=6);
writeln ('Selecciona el valor de estado conductor.');
writeln (' 1.- Ebrio');
writeln (' 2.- Sobrio');
write (' : ');
repeat
readln (estado_conductor);
if (estado_conductor<1) or (estado_conductor>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (estado_conductor>=1) and (estado_conductor<=2);
accidentes := accidentes+1;
if sexo=2 then
begin
a := a+1;
end;
if municipio=6 then
begin
b := b+1;
end;
if estado_conductor=1 then
begin
c := c+1;
end;
if edad<18 then
begin
d := d+1;
end;
writeln;
write (#168'Deseas repetir el proceso? (S/N): ');
repeat
tecla_repetir := readkey;
until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
if accidentes = 0 then
a := 0
else
a := 100.0*a/accidentes;
if accidentes = 0 then
b := 0
else
b := 100.0*b/accidentes;
if accidentes = 0 then
c := 0
else
c := 100.0*c/accidentes;
if accidentes = 0 then
d := 0
else
d := 100.0*d/accidentes;
writeln ('Valor de accidentes: ', accidentes);
writeln ('Valor de a: ', a:0:6);
writeln ('Valor de b: ', b:0:6);
writeln ('Valor de c: ', c:0:6);
writeln ('Valor de d: ', d:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.