• Lenguaje

    Pascal

  • Descripción

    Ejercicio sobre una aerolínea de manera que por cada pasajero registra: el nombre del cliente, el tipo de asiento (estándar, clase media y clase alta) y la cantidad de boletos comprados.
    En temporada baja y dependiendo de la cantidad de boletos adquiridos, al cliente se le realiza los siguientes descuentos:
    - El 10% si el cliente si compró 2 boletos.
    - Un 15% de descuento si compra 4 boletos.
    - Y un 20% de descuento si compra 5 boletos.
    Precios de boleto:
    (E) Estándar $ 20
    (D) Clase media $45
    (S) Clase alta $ 120

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 PasajeroDeAerolinea;
uses crt;

var temporada, tipo_de_asiento : integer;
var cantidad_de_boletos, descuento, subtotal, tarifa, total : real;
var nombre_del_cliente : string;
begin
    write ('Ingresa el nombre del cliente: ');
    readln (nombre_del_cliente);
    write ('Ingresa el valor de cantidad de boletos: ');
    readln (cantidad_de_boletos);
    writeln ('Selecciona el valor de tipo de asiento.');
    writeln ('    1.- E Est'#160'ndar');
    writeln ('    2.- D Clase media');
    writeln ('    3.- S Clase alta');
    write ('    : ');
    repeat
        readln (tipo_de_asiento);
        if (tipo_de_asiento<1) or (tipo_de_asiento>3) then
            write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
    until (tipo_de_asiento>=1) and (tipo_de_asiento<=3);
    writeln ('Selecciona el valor de temporada.');
    writeln ('    1.- Baja');
    writeln ('    2.- Alta');
    write ('    : ');
    repeat
        readln (temporada);
        if (temporada<1) or (temporada>2) then
            write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
    until (temporada>=1) and (temporada<=2);
    descuento := 0;
    subtotal := 0;
    tarifa := 0;
    if tipo_de_asiento=1 then
        begin
            tarifa := 20;
        end;
    if tipo_de_asiento=2 then
        begin
            tarifa := 45;
        end;
    if tipo_de_asiento=3 then
        begin
            tarifa := 120;
        end;
    subtotal := cantidad_de_boletos*tarifa;
    if (temporada=1) and (cantidad_de_boletos=2) then
        begin
            descuento := subtotal*0.1;
        end;
    if (temporada=1) and (cantidad_de_boletos=4) then
        begin
            descuento := subtotal*0.15;
        end;
    if (temporada=1) and (cantidad_de_boletos=5) then
        begin
            descuento := subtotal*0.2;
        end;
    total := subtotal-descuento;
    writeln ('Nombre del cliente: ', nombre_del_cliente);
    writeln ('Valor de descuento: ', descuento:0:6);
    writeln ('Valor de subtotal: ', subtotal:0:6);
    writeln ('Valor de tarifa: ', tarifa:0:6);
    writeln ('Valor de total: ', total:0:6);
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.