• Lenguaje

    Pascal

  • Descripción

    Se desea un programa que dado el modelo del auto determine el descuento a otorgar.
    Código | Modelo | Descuento
    1 | Sedán | 10%
    2 | Pickup | 12%
    3 | Camioneta | 5%
    4 | Deportivo | 2%
    El programa debe indicar en su salida el modelo, el valor del auto antes del descuento, el valor del auto con descuento, el descuento, el impuesto del 10% y el monto a pagar.

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

var modelo : integer;
var auto_antes_del_descuento, auto_con_descuento, descuento, impuesto, monto_a_pagar : real;
begin
    write ('Ingresa el valor de auto antes del descuento: ');
    readln (auto_antes_del_descuento);
    descuento := 0;
    writeln ('Selecciona el valor de modelo.');
    writeln ('    1.- Sed'#160'n');
    writeln ('    2.- Pickup');
    writeln ('    3.- Camioneta');
    writeln ('    4.- Deportivo');
    write ('    : ');
    repeat
        readln (modelo);
        if (modelo<1) or (modelo>4) then
            write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
    until (modelo>=1) and (modelo<=4);
    if modelo=1 then
        begin
            writeln ('Sed'#160'n');
            descuento := auto_antes_del_descuento*0.1;
        end;
    if modelo=2 then
        begin
            writeln ('Pickup');
            descuento := auto_antes_del_descuento*0.12;
        end;
    if modelo=3 then
        begin
            writeln ('Camioneta');
            descuento := auto_antes_del_descuento*0.05;
        end;
    if modelo=4 then
        begin
            writeln ('Deportivo');
            descuento := auto_antes_del_descuento*0.02;
        end;
    auto_con_descuento := auto_antes_del_descuento-descuento;
    impuesto := auto_con_descuento*0.1;
    monto_a_pagar := auto_con_descuento+impuesto;
    writeln ('Valor de auto con descuento: ', auto_con_descuento:0:6);
    writeln ('Valor de descuento: ', descuento:0:6);
    writeln ('Valor de impuesto: ', impuesto:0:6);
    writeln ('Valor de monto a pagar: ', monto_a_pagar:0:6);
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.