-
Lenguaje
Pascal
-
Descripción
Un cliente desea comprar una cantidad de pantalones del mismo tipo, se ofrecen los siguientes precios unitarios según el tipo:
Tipo | Precio
Deportivo | 50
Casual | 60
Elegante | 70
Se afectará rebajar a las personas que compren varias prendas del mismo tipo base a lo que se indica en la tabla:
Cantidad | Descuento
1-10 | 3%
11-16 | 5%
17 a mas | 7%
Diseñe un allgoritmo que determine cuanto es el monto del descuento, monto final a pagar.
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
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
program CompraDePantalonesConDescuento;
uses crt;
var tipo : integer;
var cantidad, monto_del_descuento, monto_final_a_pagar, precio, subtotal : real;
begin
write ('Ingresa el valor de cantidad: ');
readln (cantidad);
writeln ('Selecciona el valor de tipo.');
writeln (' 1.- Deportivo');
writeln (' 2.- Casual');
writeln (' 3.- Elegante');
write (' : ');
repeat
readln (tipo);
if (tipo<1) or (tipo>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo>=1) and (tipo<=3);
precio := 0;
if tipo=1 then
begin
precio := 50;
end;
if tipo=2 then
begin
precio := 60;
end;
if tipo=3 then
begin
precio := 70;
end;
subtotal := precio*cantidad;
monto_del_descuento := 0;
if (cantidad>=1) and (cantidad<=10) then
begin
monto_del_descuento := subtotal*0.03;
end;
if (cantidad>=11) and (cantidad<=16) then
begin
monto_del_descuento := subtotal*0.05;
end;
if cantidad>=17 then
begin
monto_del_descuento := subtotal*0.07;
end;
monto_final_a_pagar := subtotal-monto_del_descuento;
writeln ('Valor de monto del descuento: ', monto_del_descuento:0:6);
writeln ('Valor de monto final a pagar: ', monto_final_a_pagar:0:6);
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var tipo : integer;
var cantidad, monto_del_descuento, monto_final_a_pagar, precio, subtotal : real;
begin
write ('Ingresa el valor de cantidad: ');
readln (cantidad);
writeln ('Selecciona el valor de tipo.');
writeln (' 1.- Deportivo');
writeln (' 2.- Casual');
writeln (' 3.- Elegante');
write (' : ');
repeat
readln (tipo);
if (tipo<1) or (tipo>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo>=1) and (tipo<=3);
precio := 0;
if tipo=1 then
begin
precio := 50;
end;
if tipo=2 then
begin
precio := 60;
end;
if tipo=3 then
begin
precio := 70;
end;
subtotal := precio*cantidad;
monto_del_descuento := 0;
if (cantidad>=1) and (cantidad<=10) then
begin
monto_del_descuento := subtotal*0.03;
end;
if (cantidad>=11) and (cantidad<=16) then
begin
monto_del_descuento := subtotal*0.05;
end;
if cantidad>=17 then
begin
monto_del_descuento := subtotal*0.07;
end;
monto_final_a_pagar := subtotal-monto_del_descuento;
writeln ('Valor de monto del descuento: ', monto_del_descuento:0:6);
writeln ('Valor de monto final a pagar: ', monto_final_a_pagar:0:6);
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.