-
Lenguaje
Pascal
-
Descripción
Restaurante "El Gordiño" abre sus puertas con última tecnología, por lo que le han solicitado un programa en el que el cliente indique la modalidad de comida que desea y se despliegue el monto a pagar. Las modalidades y sus montos son: Buffete ¢7,000 y a la Carta ¢5,000. Además tome en cuenta que si se es cliente frecuente se ofrece un descuento del 20%. Diseñe el programa que lea los valores requeridos e imprima un ticket con 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
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
program RestauranteElGordino;
uses crt;
var es_cliente_frecuente, modalidad : integer;
var descuento, monto_a_pagar, total : real;
begin
writeln ('Selecciona el valor de modalidad.');
writeln (' 1.- Buffete');
writeln (' 2.- Carta');
write (' : ');
repeat
readln (modalidad);
if (modalidad<1) or (modalidad>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (modalidad>=1) and (modalidad<=2);
writeln ('Selecciona el valor de es cliente frecuente.');
writeln (' 1.- Si');
writeln (' 2.- No');
write (' : ');
repeat
readln (es_cliente_frecuente);
if (es_cliente_frecuente<1) or (es_cliente_frecuente>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (es_cliente_frecuente>=1) and (es_cliente_frecuente<=2);
if modalidad=1 then
begin
monto_a_pagar := 7000;
end
else
begin
monto_a_pagar := 5000;
end;
if es_cliente_frecuente=1 then
begin
descuento := monto_a_pagar*0.2;
end
else
begin
descuento := 0;
end;
total := monto_a_pagar-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de monto a pagar: ', monto_a_pagar:0:6);
writeln ('Valor de total: ', total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var es_cliente_frecuente, modalidad : integer;
var descuento, monto_a_pagar, total : real;
begin
writeln ('Selecciona el valor de modalidad.');
writeln (' 1.- Buffete');
writeln (' 2.- Carta');
write (' : ');
repeat
readln (modalidad);
if (modalidad<1) or (modalidad>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (modalidad>=1) and (modalidad<=2);
writeln ('Selecciona el valor de es cliente frecuente.');
writeln (' 1.- Si');
writeln (' 2.- No');
write (' : ');
repeat
readln (es_cliente_frecuente);
if (es_cliente_frecuente<1) or (es_cliente_frecuente>2) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (es_cliente_frecuente>=1) and (es_cliente_frecuente<=2);
if modalidad=1 then
begin
monto_a_pagar := 7000;
end
else
begin
monto_a_pagar := 5000;
end;
if es_cliente_frecuente=1 then
begin
descuento := monto_a_pagar*0.2;
end
else
begin
descuento := 0;
end;
total := monto_a_pagar-descuento;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de monto a pagar: ', monto_a_pagar:0:6);
writeln ('Valor de total: ', total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.