-
Lenguaje
Pascal
-
Descripción
Una tienda comercial por campaña otorgará puntos adicionales a los clientes de sexo femenino que tengan la tarjeta de puntos de acuerdo a la edad de la persona. Los clientes menores de 18 años recibirán un adicional de 1000 puntos, de 18 años hasta menores de 25 años otorgará 2000 puntos y de 25 años a más recibirán 4000 puntos. Considerar que la cantidad de puntos otorgados se acumulará al puntaje de la tarjeta. Los datos de ingreso son nombre, edad, sexo y tiene tarjeta (Si/No).
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
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
program PuntosAdicionales;
uses crt;
var edad, puntos, sexo, tiene_tarjeta : integer;
var nombre : string;
begin
write ('Ingresa el nombre: ');
readln (nombre);
write ('Ingresa el valor de edad: ');
readln (edad);
writeln ('Selecciona el valor de sexo.');
writeln (' 1.- Femenino');
writeln (' 2.- Masculino');
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 tiene tarjeta.');
writeln (' 1.- Si');
writeln (' 2.- No');
write (' : ');
repeat
readln (tiene_tarjeta);
if (tiene_tarjeta<1) or (tiene_tarjeta>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tiene_tarjeta>=1) and (tiene_tarjeta<=2);
puntos := 0;
if (sexo=1) and (tiene_tarjeta=1) and (edad<18) then
begin
puntos := 1000;
end;
if (sexo=1) and (tiene_tarjeta=1) and (edad>=18) and (edad<25) then
begin
puntos := 2000;
end;
if (sexo=1) and (tiene_tarjeta=1) and (edad>=25) then
begin
puntos := 4000;
end;
writeln ('Nombre: ', nombre);
writeln ('Valor de puntos: ', puntos);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var edad, puntos, sexo, tiene_tarjeta : integer;
var nombre : string;
begin
write ('Ingresa el nombre: ');
readln (nombre);
write ('Ingresa el valor de edad: ');
readln (edad);
writeln ('Selecciona el valor de sexo.');
writeln (' 1.- Femenino');
writeln (' 2.- Masculino');
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 tiene tarjeta.');
writeln (' 1.- Si');
writeln (' 2.- No');
write (' : ');
repeat
readln (tiene_tarjeta);
if (tiene_tarjeta<1) or (tiene_tarjeta>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tiene_tarjeta>=1) and (tiene_tarjeta<=2);
puntos := 0;
if (sexo=1) and (tiene_tarjeta=1) and (edad<18) then
begin
puntos := 1000;
end;
if (sexo=1) and (tiene_tarjeta=1) and (edad>=18) and (edad<25) then
begin
puntos := 2000;
end;
if (sexo=1) and (tiene_tarjeta=1) and (edad>=25) then
begin
puntos := 4000;
end;
writeln ('Nombre: ', nombre);
writeln ('Valor de puntos: ', puntos);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.