-
Lenguaje
Pascal
-
Descripción
Una zapatería vende tres tipos de zapatos: tenis, sandalias y botas cada uno a un precio de 300, 250 y 750 respectivamente. El programa debe pedir el tipo de zapato que se está comprando y la cantidad, posteriormente debe mostrar el total de la venta, el descuento considerando lo siguiente:
- Si cuenta con membresía se le descuenta otro 5%.
- Si la compra fue mayor a 1200 o compro más de tres pares recibirá un 8% de descuento.
- El total de la compra con descuento.
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
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
program DescuentoPorTipoDeZapato;
uses crt;
var cuenta_con_membresia, tipo_de_zapato : integer;
var cantidad, compra, descuento, precio, total_venta : real;
begin
write ('Ingresa el valor de cantidad: ');
readln (cantidad);
precio := 0;
descuento := 0;
writeln ('Selecciona el valor de tipo de zapato.');
writeln (' 1.- Tenis');
writeln (' 2.- Sandalias');
writeln (' 3.- Botas');
write (' : ');
repeat
readln (tipo_de_zapato);
if (tipo_de_zapato<1) or (tipo_de_zapato>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_zapato>=1) and (tipo_de_zapato<=3);
writeln ('Selecciona el valor de cuenta con membresia.');
writeln (' 1.- Si');
writeln (' 2.- No');
write (' : ');
repeat
readln (cuenta_con_membresia);
if (cuenta_con_membresia<1) or (cuenta_con_membresia>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (cuenta_con_membresia>=1) and (cuenta_con_membresia<=2);
if tipo_de_zapato=1 then
begin
precio := 300;
end;
if tipo_de_zapato=2 then
begin
precio := 250;
end;
if tipo_de_zapato=3 then
begin
precio := 750;
end;
compra := precio*cantidad;
if cuenta_con_membresia=1 then
begin
descuento := descuento+compra*0.05;
end;
if (compra>1200) or (cantidad>3) then
begin
descuento := descuento+compra*0.08;
end;
total_venta := compra-descuento;
writeln ('Valor de compra: ', compra:0:6);
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de total venta: ', total_venta:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var cuenta_con_membresia, tipo_de_zapato : integer;
var cantidad, compra, descuento, precio, total_venta : real;
begin
write ('Ingresa el valor de cantidad: ');
readln (cantidad);
precio := 0;
descuento := 0;
writeln ('Selecciona el valor de tipo de zapato.');
writeln (' 1.- Tenis');
writeln (' 2.- Sandalias');
writeln (' 3.- Botas');
write (' : ');
repeat
readln (tipo_de_zapato);
if (tipo_de_zapato<1) or (tipo_de_zapato>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_zapato>=1) and (tipo_de_zapato<=3);
writeln ('Selecciona el valor de cuenta con membresia.');
writeln (' 1.- Si');
writeln (' 2.- No');
write (' : ');
repeat
readln (cuenta_con_membresia);
if (cuenta_con_membresia<1) or (cuenta_con_membresia>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (cuenta_con_membresia>=1) and (cuenta_con_membresia<=2);
if tipo_de_zapato=1 then
begin
precio := 300;
end;
if tipo_de_zapato=2 then
begin
precio := 250;
end;
if tipo_de_zapato=3 then
begin
precio := 750;
end;
compra := precio*cantidad;
if cuenta_con_membresia=1 then
begin
descuento := descuento+compra*0.05;
end;
if (compra>1200) or (cantidad>3) then
begin
descuento := descuento+compra*0.08;
end;
total_venta := compra-descuento;
writeln ('Valor de compra: ', compra:0:6);
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de total venta: ', total_venta:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.