• Lenguaje

    Pascal

  • Descripción

    En una agencia de transporte, se desea llevar el control del la venta de pasaje de un cliente, para ello se considera el destino, el costo, según la tabla, también se sabe que por cada destino se aplica un descuento.
    Destino | Piura | Lima | Arequipa | Tumbes | Ica
    Costo | 35 | 90 | 150 | 60 | 130
    Porcentaje % | 10 | 20 | 30 | 25 | 35

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

var destino : integer;
var costo, descuento, venta : real;
begin
    costo := 0;
    descuento := 0;
    writeln ('Selecciona el valor de destino.');
    writeln ('    1.- Piura');
    writeln ('    2.- Lima');
    writeln ('    3.- Arequipa');
    writeln ('    4.- Tumbes');
    writeln ('    5.- Ica');
    write ('    : ');
    repeat
        readln (destino);
        if (destino<1) or (destino>5) then
            write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
    until (destino>=1) and (destino<=5);
    if destino=1 then
        begin
            costo := 35;
        end;
    if destino=2 then
        begin
            costo := 90;
        end;
    if destino=3 then
        begin
            costo := 150;
        end;
    if destino=4 then
        begin
            costo := 60;
        end;
    if destino=5 then
        begin
            costo := 130;
        end;
    if destino=1 then
        begin
            descuento := costo*0.1;
        end;
    if destino=2 then
        begin
            descuento := costo*0.2;
        end;
    if destino=3 then
        begin
            descuento := costo*0.3;
        end;
    if destino=4 then
        begin
            descuento := costo*0.25;
        end;
    if destino=5 then
        begin
            descuento := costo*0.35;
        end;
    venta := costo-descuento;
    writeln ('Valor de costo: ', costo:0:6);
    writeln ('Valor de descuento: ', descuento:0:6);
    writeln ('Valor de venta: ', venta:0:6);
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.