• Lenguaje

    Pascal

  • Descripción

    En una tienda de accesorios para computadoras, el precio de venta unitario de los CDs es el mismo para cualquier marca, sin embargo, el descuento varía de acuerdo a las marcas y se establece en la siguiente tabla.

    Marca | Descuento
    3M | 10
    Princo | 15
    Samsung | 20
    LG | 25
    Sony | 30

    Se debe de considerar que los descuentos son aplicados los sábados y domingos en el turno mañana y tarde.

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

var dia, marca, turno : integer;
var descuento, precio_unitario, total : real;
begin
    write ('Ingresa el valor de precio unitario: ');
    readln (precio_unitario);
    descuento := 0;
    writeln ('Selecciona el valor de dia.');
    writeln ('    1.- Domingo');
    writeln ('    2.- Lunes');
    writeln ('    3.- Martes');
    writeln ('    4.- Mi'#130'rcoles');
    writeln ('    5.- Jueves');
    writeln ('    6.- Viernes');
    writeln ('    7.- S'#160'bado');
    write ('    : ');
    repeat
        readln (dia);
        if (dia<1) or (dia>7) then
            write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
    until (dia>=1) and (dia<=7);
    writeln ('Selecciona el valor de turno.');
    writeln ('    1.- Ma'#164'ana');
    writeln ('    2.- Tarde');
    writeln ('    3.- Noche');
    write ('    : ');
    repeat
        readln (turno);
        if (turno<1) or (turno>3) then
            write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
    until (turno>=1) and (turno<=3);
    writeln ('Selecciona el valor de marca.');
    writeln ('    1.- 3M');
    writeln ('    2.- Princo');
    writeln ('    3.- Samsung');
    writeln ('    4.- LG');
    writeln ('    5.- Sony');
    write ('    : ');
    repeat
        readln (marca);
        if (marca<1) or (marca>5) then
            write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
    until (marca>=1) and (marca<=5);
    if ((dia=1) or (dia=7)) and ((turno=1) or (turno=2)) and (marca=1) then
        begin
            descuento := precio_unitario*0.1;
        end;
    if ((dia=1) or (dia=7)) and ((turno=1) or (turno=2)) and (marca=2) then
        begin
            descuento := precio_unitario*0.15;
        end;
    if ((dia=1) or (dia=7)) and ((turno=1) or (turno=2)) and (marca=3) then
        begin
            descuento := precio_unitario*0.2;
        end;
    if ((dia=1) or (dia=7)) and ((turno=1) or (turno=2)) and (marca=4) then
        begin
            descuento := precio_unitario*0.25;
        end;
    if ((dia=1) or (dia=7)) and ((turno=1) or (turno=2)) and (marca=5) then
        begin
            descuento := precio_unitario*0.30;
        end;
    total := precio_unitario-descuento;
    writeln ('Valor de descuento: ', descuento:0:6);
    writeln ('Valor de total: ', total:0:6);
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.