• Lenguaje

    Pascal

  • Descripción

    Un establecimiento comercial decidió establecer una tabla de descuentos, al momento de realizar la venta y de acuerdo con el PRECIO UNITARIO del artículo, calcular descuento ofrecido y precio de venta final, teniendo en cuenta la siguiente tabla:
    PRECIO UNITARIO | % DESCUENTO
    Entre 1 y 45000 | 5%
    Entre 45001 y 70000 | 8%
    Entre 70001 y 95000 | 9%
    Más de 95000 | 12%

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
program EstablecimientoComercial;
uses crt;

var cantidad_de_articulos, descuento, precio_unitario, subtotal, venta : real;
begin
    write ('Ingresa el valor de cantidad de articulos: ');
    readln (cantidad_de_articulos);
    write ('Ingresa el valor de precio unitario: ');
    readln (precio_unitario);
    subtotal := precio_unitario*cantidad_de_articulos;
    descuento := 0;
    if (precio_unitario>=1) and (precio_unitario<=45000) then
        begin
            descuento := subtotal*0.05;
        end;
    if (precio_unitario>=45001) and (precio_unitario<=70000) then
        begin
            descuento := subtotal*0.08;
        end;
    if (precio_unitario>=70001) and (precio_unitario<=95000) then
        begin
            descuento := subtotal*0.09;
        end;
    if precio_unitario>95000 then
        begin
            descuento := subtotal*0.12;
        end;
    venta := subtotal-descuento;
    writeln ('Valor de descuento: ', descuento:0:6);
    writeln ('Valor de subtotal: ', subtotal:0:6);
    writeln ('Valor de venta: ', venta:0:6);
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.