-
Lenguaje
Pascal
-
Descripción
Una tienda de venta de polos ha establecido porcentajes de descuento, indicados a continuación, de acuerdo a las características de la prenda: Tipo de algodón (Simple, Pima), Tipo de prenda (Niño, Joven, Adulto):
Tipo de algodón | 1 Niño | 2 Joven
1 Simple | 15% | 10%
2 Pima | 10% | 5%
Calcular el importe a pagar por una determinada cantidad de prendas.
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
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
program TiendaDePolos;
uses crt;
var tipo_de_algodon, tipo_de_prenda : integer;
var descuento, importe_a_pagar, subtotal : real;
begin
write ('Ingresa el valor de subtotal: ');
readln (subtotal);
writeln ('Selecciona el valor de tipo de algodon.');
writeln (' 1.- Simple');
writeln (' 2.- Pima');
write (' : ');
repeat
readln (tipo_de_algodon);
if (tipo_de_algodon<1) or (tipo_de_algodon>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_algodon>=1) and (tipo_de_algodon<=2);
writeln ('Selecciona el valor de tipo de prenda.');
writeln (' 1.- Ni'#164'o');
writeln (' 2.- Joven');
writeln (' 3.- Adulto');
write (' : ');
repeat
readln (tipo_de_prenda);
if (tipo_de_prenda<1) or (tipo_de_prenda>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_prenda>=1) and (tipo_de_prenda<=3);
descuento := 0;
if (tipo_de_algodon=1) and (tipo_de_prenda=1) then
begin
descuento := subtotal*0.15;
end;
if (tipo_de_algodon=1) and (tipo_de_prenda=2) then
begin
descuento := subtotal*0.1;
end;
if (tipo_de_algodon=2) and (tipo_de_prenda=1) then
begin
descuento := subtotal*0.1;
end;
if (tipo_de_algodon=2) and (tipo_de_prenda=2) then
begin
descuento := subtotal*0.05;
end;
importe_a_pagar := subtotal-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de importe a pagar: ', importe_a_pagar:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var tipo_de_algodon, tipo_de_prenda : integer;
var descuento, importe_a_pagar, subtotal : real;
begin
write ('Ingresa el valor de subtotal: ');
readln (subtotal);
writeln ('Selecciona el valor de tipo de algodon.');
writeln (' 1.- Simple');
writeln (' 2.- Pima');
write (' : ');
repeat
readln (tipo_de_algodon);
if (tipo_de_algodon<1) or (tipo_de_algodon>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_algodon>=1) and (tipo_de_algodon<=2);
writeln ('Selecciona el valor de tipo de prenda.');
writeln (' 1.- Ni'#164'o');
writeln (' 2.- Joven');
writeln (' 3.- Adulto');
write (' : ');
repeat
readln (tipo_de_prenda);
if (tipo_de_prenda<1) or (tipo_de_prenda>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_prenda>=1) and (tipo_de_prenda<=3);
descuento := 0;
if (tipo_de_algodon=1) and (tipo_de_prenda=1) then
begin
descuento := subtotal*0.15;
end;
if (tipo_de_algodon=1) and (tipo_de_prenda=2) then
begin
descuento := subtotal*0.1;
end;
if (tipo_de_algodon=2) and (tipo_de_prenda=1) then
begin
descuento := subtotal*0.1;
end;
if (tipo_de_algodon=2) and (tipo_de_prenda=2) then
begin
descuento := subtotal*0.05;
end;
importe_a_pagar := subtotal-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de importe a pagar: ', importe_a_pagar:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.