-
Lenguaje
Pascal
-
Descripción
El valor de descuento que se aplica a cada estudiante de la Universidad depende del distrito de procedencia. Tome en cuenta la siguiente tabla, que permita calcular el descuento que se realiza a un estudiante e imprima cual es la cantidad de dinero que deja de percibir el administrador de la Universidad en concepto de descuento.
Clave | Distrito | Descuento
1 | La Molina | 02%
2 | San Isidro | 10%
3 | Surco | 15%
4 | Los Olivos | 18%
5 | Independencia | 20%
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
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
program DescuentoPorDistritoDeProcedencia;
uses crt;
var distrito : integer;
var cuota, descuento : real;
begin
write ('Ingresa el valor de cuota: ');
readln (cuota);
writeln ('Selecciona el valor de distrito.');
writeln (' 1.- La Molina');
writeln (' 2.- San Isidro');
writeln (' 3.- Surco');
writeln (' 4.- Los Olivos');
writeln (' 5.- Independencia');
write (' : ');
repeat
readln (distrito);
if (distrito<1) or (distrito>5) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (distrito>=1) and (distrito<=5);
descuento := 0;
if distrito=1 then
begin
descuento := cuota*0.02;
end;
if distrito=2 then
begin
descuento := cuota*0.1;
end;
if distrito=3 then
begin
descuento := cuota*0.15;
end;
if distrito=4 then
begin
descuento := cuota*0.18;
end;
if distrito=5 then
begin
descuento := cuota*0.2;
end;
writeln ('Valor de descuento: ', descuento:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var distrito : integer;
var cuota, descuento : real;
begin
write ('Ingresa el valor de cuota: ');
readln (cuota);
writeln ('Selecciona el valor de distrito.');
writeln (' 1.- La Molina');
writeln (' 2.- San Isidro');
writeln (' 3.- Surco');
writeln (' 4.- Los Olivos');
writeln (' 5.- Independencia');
write (' : ');
repeat
readln (distrito);
if (distrito<1) or (distrito>5) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (distrito>=1) and (distrito<=5);
descuento := 0;
if distrito=1 then
begin
descuento := cuota*0.02;
end;
if distrito=2 then
begin
descuento := cuota*0.1;
end;
if distrito=3 then
begin
descuento := cuota*0.15;
end;
if distrito=4 then
begin
descuento := cuota*0.18;
end;
if distrito=5 then
begin
descuento := cuota*0.2;
end;
writeln ('Valor de descuento: ', descuento:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.