• Lenguaje

    Pascal

  • Descripción

    La empresa de renta de autos tiene tres tipos de vehículos y se rentan por día.
    Si la renta es menor a 5 días, tiene un cargo adicional del 7.5% sobre el costo diario.
    Calcular el monto que se debe cobrar por la renta de un vehículo.
    Chico: $800
    Mediano: $1,200
    Grande: $1,600

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

var tipo_de_vehiculo : integer;
var cargo_adicional, costo_diario, monto_a_cobrar, numero_de_dias, renta : real;
begin
    write ('Ingresa el valor de numero de dias: ');
    readln (numero_de_dias);
    costo_diario := 0;
    writeln ('Selecciona el valor de tipo de vehiculo.');
    writeln ('    1.- Chico');
    writeln ('    2.- Mediano');
    writeln ('    3.- Grande');
    write ('    : ');
    repeat
        readln (tipo_de_vehiculo);
        if (tipo_de_vehiculo<1) or (tipo_de_vehiculo>3) then
            write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
    until (tipo_de_vehiculo>=1) and (tipo_de_vehiculo<=3);
    if tipo_de_vehiculo=1 then
        begin
            costo_diario := 800;
        end;
    if tipo_de_vehiculo=2 then
        begin
            costo_diario := 1200;
        end;
    if tipo_de_vehiculo=3 then
        begin
            costo_diario := 1600;
        end;
    renta := costo_diario*numero_de_dias;
    if numero_de_dias<5 then
        begin
            cargo_adicional := renta*0.075;
        end
    else
        begin
            cargo_adicional := 0;
        end;
    monto_a_cobrar := renta+cargo_adicional;
    writeln ('Valor de cargo adicional: ', cargo_adicional:0:6);
    writeln ('Valor de costo diario: ', costo_diario:0:6);
    writeln ('Valor de monto a cobrar: ', monto_a_cobrar:0:6);
    writeln ('Valor de renta: ', renta:0:6);
    writeln;
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.