• Lenguaje

    Pascal

  • Descripción

    Recopilar datos del cliente para la factura:
    - CI
    - Nombre
    - Apellido
    - Teléfono
    - Correo
    Comprar entradas al cine. Sólo si son 4 o más entradas aplicar un descuento según el tipo de transacción:
    - Efectivo: aplica descuento 5%.
    - Tarjeta: aplica un 3.5 % de descuento.
    - Caso contrario no aplica descuento.

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

var tipo_de_transaccion : integer;
var costo_por_entrada, descuento, entradas, subtotal, total : real;
var CI, Nombre, Apellido, Telefono, Correo : string;
begin
    write ('Ingresa el CI: ');
    readln (CI);
    write ('Ingresa el Nombre: ');
    readln (Nombre);
    write ('Ingresa el Apellido: ');
    readln (Apellido);
    write ('Ingresa el Telefono: ');
    readln (Telefono);
    write ('Ingresa el Correo: ');
    readln (Correo);
    write ('Ingresa el valor de costo por entrada: ');
    readln (costo_por_entrada);
    write ('Ingresa el valor de entradas: ');
    readln (entradas);
    descuento := 0;
    subtotal := entradas*costo_por_entrada;
    writeln ('Selecciona el valor de tipo de transaccion.');
    writeln ('    1.- Efectivo');
    writeln ('    2.- Tarjeta');
    write ('    : ');
    repeat
        readln (tipo_de_transaccion);
        if (tipo_de_transaccion<1) or (tipo_de_transaccion>2) then
            write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
    until (tipo_de_transaccion>=1) and (tipo_de_transaccion<=2);
    if (entradas>=4) and (tipo_de_transaccion=1) then
        begin
            descuento := subtotal*0.05;
        end;
    if (entradas>=4) and (tipo_de_transaccion=2) then
        begin
            descuento := subtotal*0.035;
        end;
    total := subtotal-descuento;
    writeln ('CI: ', CI);
    writeln ('Nombre: ', Nombre);
    writeln ('Apellido: ', Apellido);
    writeln ('Telefono: ', Telefono);
    writeln ('Correo: ', Correo);
    writeln ('Valor de descuento: ', descuento:0:6);
    writeln ('Valor de subtotal: ', subtotal:0:6);
    writeln ('Valor de total: ', total:0:6);
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.