-
Lenguaje
Pascal
-
Descripción
En una zapatería se aplica el 20% de descuento en calzado femenino y el 10% al masculino. Esta promoción aplica únicamente cada fin de mes del 25 al 31. Si la compra es superior a los $2000 aplica un descuento del 15% adicional aplicado a fin de mes.
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
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
program DescuentoEnUnaZapateria;
uses crt;
var tipo_de_calzado : integer;
var compra, descuento, dia_del_mes, total : real;
begin
write ('Ingresa el valor de compra: ');
readln (compra);
write ('Ingresa el valor de dia del mes: ');
readln (dia_del_mes);
writeln ('Selecciona el valor de tipo de calzado.');
writeln (' 1.- Femenino');
writeln (' 2.- Masculino');
write (' : ');
repeat
readln (tipo_de_calzado);
if (tipo_de_calzado<1) or (tipo_de_calzado>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_calzado>=1) and (tipo_de_calzado<=2);
descuento := 0;
if (dia_del_mes>=25) and (dia_del_mes<=31) and (tipo_de_calzado=1) then
begin
descuento := descuento+compra*0.2;
end;
if (dia_del_mes>=25) and (dia_del_mes<=31) and (tipo_de_calzado=2) then
begin
descuento := descuento+compra*0.1;
end;
if (dia_del_mes>=25) and (dia_del_mes<=31) and (compra>2000) then
begin
descuento := descuento+compra*0.15;
end;
total := compra-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de total: ', total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var tipo_de_calzado : integer;
var compra, descuento, dia_del_mes, total : real;
begin
write ('Ingresa el valor de compra: ');
readln (compra);
write ('Ingresa el valor de dia del mes: ');
readln (dia_del_mes);
writeln ('Selecciona el valor de tipo de calzado.');
writeln (' 1.- Femenino');
writeln (' 2.- Masculino');
write (' : ');
repeat
readln (tipo_de_calzado);
if (tipo_de_calzado<1) or (tipo_de_calzado>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_calzado>=1) and (tipo_de_calzado<=2);
descuento := 0;
if (dia_del_mes>=25) and (dia_del_mes<=31) and (tipo_de_calzado=1) then
begin
descuento := descuento+compra*0.2;
end;
if (dia_del_mes>=25) and (dia_del_mes<=31) and (tipo_de_calzado=2) then
begin
descuento := descuento+compra*0.1;
end;
if (dia_del_mes>=25) and (dia_del_mes<=31) and (compra>2000) then
begin
descuento := descuento+compra*0.15;
end;
total := compra-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de total: ', total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.