-
Lenguaje
Pascal
-
Descripción
Una empresa de servicios de comunicaciones por aniversario otorga a sus clientes megas para navegar por internet dentro de su planes actuales. Considerar que los clientes se encuentran en los siguientes planes:
Tipo de Plan
A
B
C
Los clientes que se encuentren en el plan A ó B, recibirán megas de acuerdo al tiempo de antigüedad como cliente, como se muestra en la tabla:
Tiempo antigüedad (años) | Megas otorgados
tiempo <= 4 | 20
4 < tiempo <= 10 | 30
10 < tiempo | 40
En el caso de los usuarios de plan C tendrán 10 megas otorgados. Considerar los datos de ingreso: nombre, tipo de plan, tiempo de antigüedad y cantidad actual de megas disponibles.
Se requiere calcular la cantidad actual de megas del cliente.
1. Ingreso de datos.
2. Cantidad de actual de megas .
3. Visualizar nombre, plan y cantidad actual de megas.
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
52
uses crt;
var antiguedad, megas, plan : integer;
var nombre : string;
begin
write ('Ingresa el nombre: ');
readln (nombre);
write ('Ingresa el valor de antiguedad: ');
readln (antiguedad);
megas := 0;
writeln ('Selecciona el valor de plan.');
writeln (' 1.- A');
writeln (' 2.- B');
writeln (' 3.- C');
write (' : ');
repeat
readln (plan);
if (plan<1) or (plan>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (plan>=1) and (plan<=3);
if plan=1 then
begin
writeln ('Plan A');
end;
if plan=2 then
begin
writeln ('Plan B');
end;
if plan=3 then
begin
writeln ('Plan C');
megas := 10;
end;
if ((plan=1) or (plan=2)) and (antiguedad<=4) then
begin
megas := 20;
end;
if ((plan=1) or (plan=2)) and (antiguedad>4) and (antiguedad<=10) then
begin
megas := 30;
end;
if ((plan=1) or (plan=2)) and (antiguedad>10) then
begin
megas := 40;
end;
writeln ('Nombre: ', nombre);
writeln ('Valor de megas: ', megas);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.