-
Lenguaje
Pascal
-
Descripción
Una compañía de seguros ofrece a sus clientes tres tipos de seguro:
Pago mensual (S/.) | Tipo
40 | Vida
30 | Accidente
20 | Salud
Si el cliente asegura a más personas de 5 personas, tiene que pagar 8% más del monto total. Calcular el monto final que tiene que pagar un cliente.
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
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
program TresTiposDeSeguro;
uses crt;
var tipo_de_seguro : integer;
var monto_final, monto_total, personas_aseguradas : real;
begin
write ('Ingresa el valor de personas aseguradas: ');
readln (personas_aseguradas);
monto_total := 0;
writeln ('Selecciona el valor de tipo de seguro.');
writeln (' 1.- Vida');
writeln (' 2.- Accidente');
writeln (' 3.- Salud');
write (' : ');
repeat
readln (tipo_de_seguro);
if (tipo_de_seguro<1) or (tipo_de_seguro>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_seguro>=1) and (tipo_de_seguro<=3);
if tipo_de_seguro=1 then
begin
monto_total := 40;
end;
if tipo_de_seguro=2 then
begin
monto_total := 30;
end;
if tipo_de_seguro=3 then
begin
monto_total := 20;
end;
if personas_aseguradas>5 then
begin
monto_final := monto_total*1.08;
end
else
begin
monto_final := monto_total;
end;
writeln ('Valor de monto final: ', monto_final:0:6);
writeln ('Valor de monto total: ', monto_total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var tipo_de_seguro : integer;
var monto_final, monto_total, personas_aseguradas : real;
begin
write ('Ingresa el valor de personas aseguradas: ');
readln (personas_aseguradas);
monto_total := 0;
writeln ('Selecciona el valor de tipo de seguro.');
writeln (' 1.- Vida');
writeln (' 2.- Accidente');
writeln (' 3.- Salud');
write (' : ');
repeat
readln (tipo_de_seguro);
if (tipo_de_seguro<1) or (tipo_de_seguro>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_seguro>=1) and (tipo_de_seguro<=3);
if tipo_de_seguro=1 then
begin
monto_total := 40;
end;
if tipo_de_seguro=2 then
begin
monto_total := 30;
end;
if tipo_de_seguro=3 then
begin
monto_total := 20;
end;
if personas_aseguradas>5 then
begin
monto_final := monto_total*1.08;
end
else
begin
monto_final := monto_total;
end;
writeln ('Valor de monto final: ', monto_final:0:6);
writeln ('Valor de monto total: ', monto_total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.