• Lenguaje

    Pascal

  • Descripción

    Una tienda llamada Skeleton desea saber el precio de las prendas que lleva el cliente. Si lleva más de $300 aplicar descuento del 20%, si lleva más de $500 se hace el 30%, si lleva más de $1000 se hace el 35%, calcula el IVA y si quiere hacer otra transacción.

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

var IVA, descuento, subtotal, total : real;
var tecla_repetir : char;
begin
    repeat
        clrscr;
        write ('Ingresa el valor de subtotal: ');
        readln (subtotal);
        descuento := 0;
        if (subtotal>300) and (subtotal<=500) then
            begin
                descuento := subtotal*0.2;
            end;
        if (subtotal>500) and (subtotal<=1000) then
            begin
                descuento := subtotal*0.3;
            end;
        if subtotal>1000 then
            begin
                descuento := subtotal*0.35;
            end;
        IVA := (subtotal-descuento)*0.16;
        total := subtotal-descuento+IVA;
        writeln ('Valor de IVA: ', IVA:0:6);
        writeln ('Valor de descuento: ', descuento:0:6);
        writeln ('Valor de total: ', total: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');
end.