• Lenguaje

    Pascal

  • Descripción

    Una empresa vende licencias de un programa a los precios dados en la siguiente tabla:
    Versión | Precio
    Estudiante | $90.00
    Profesional | $120.00
    Empresarial | $150.00

    Como oferta especial la empresa aplica un porcentaje de descuento sobre el importe de la compra de acuerdo a la siguiente tabla:
    Cantidad de licencias | Descuento
    <5 | 11%
    ≥5 y <10 | 13%
    ≥10 | 14%

    Diseñe un programa que permita efectuar ventas y muestre luego de cada una de ellas la siguiente información:
    El importe de la compra
    El importe del descuento
    El importe a pagar
    La cantidad de licencias vendidas de cada tipo entre todas las ventas.
    El importe total acumulado de todas las ventas

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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
program LicenciasDeUnPrograma;
uses crt;

var cantidad_empresarial, cantidad_estudiante, cantidad_profesional, version : integer;
var cantidad_de_licencias, importe_a_pagar, importe_de_la_compra, importe_del_descuento, precio : real;
var total_acumulado : real;
var tecla_repetir : char;
begin
    cantidad_empresarial := 0;
    cantidad_estudiante := 0;
    cantidad_profesional := 0;
    total_acumulado := 0;
    repeat
        clrscr;
        write ('Ingresa el valor de cantidad de licencias: ');
        readln (cantidad_de_licencias);
        precio := 0;
        importe_del_descuento := 0;
        writeln ('Selecciona el valor de version.');
        writeln ('    1.- Estudiante');
        writeln ('    2.- Profesional');
        writeln ('    3.- Empresarial');
        write ('    : ');
        repeat
            readln (version);
            if (version<1) or (version>3) then
                write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
        until (version>=1) and (version<=3);
        if version=1 then
            begin
                precio := 90;
                cantidad_estudiante := cantidad_estudiante+cantidad_de_licencias;
            end;
        if version=2 then
            begin
                precio := 120;
                cantidad_profesional := cantidad_profesional+cantidad_de_licencias;
            end;
        if version=3 then
            begin
                precio := 150;
                cantidad_empresarial := cantidad_empresarial+cantidad_de_licencias;
            end;
        importe_de_la_compra := precio*cantidad_de_licencias;
        if cantidad_de_licencias<5 then
            begin
                importe_del_descuento := importe_de_la_compra*0.11;
            end;
        if (cantidad_de_licencias>=5) and (cantidad_de_licencias<10) then
            begin
                importe_del_descuento := importe_de_la_compra*0.13;
            end;
        if cantidad_de_licencias>=10 then
            begin
                importe_del_descuento := importe_de_la_compra*0.14;
            end;
        importe_a_pagar := importe_de_la_compra-importe_del_descuento;
        total_acumulado := total_acumulado+importe_a_pagar;
        writeln ('Valor de importe a pagar: ', importe_a_pagar:0:6);
        writeln ('Valor de importe de la compra: ', importe_de_la_compra:0:6);
        writeln ('Valor de importe del descuento: ', importe_del_descuento:0:6);
        writeln ('Valor de precio: ', precio:0:6);
        writeln;
        write (#168'Deseas repetir el proceso? (S/N): ');
        repeat
            tecla_repetir := readkey;
        until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
    until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
    writeln ('Valor de cantidad empresarial: ', cantidad_empresarial);
    writeln ('Valor de cantidad estudiante: ', cantidad_estudiante);
    writeln ('Valor de cantidad profesional: ', cantidad_profesional);
    writeln ('Valor de total acumulado: ', total_acumulado:0:6);
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.