-
Lenguaje
Pascal
-
Descripción
Calcular e imprimir el recibo que se le debería dar a un cliente que va al restaurante "Comida mexicana". El menú es:
a. Sodas lata $15.50 c/u
b. Agua de sabor $25.00 c/u
c. Orden de burritos $80.50 c/u
d. Sopes $25.60 c/u
e. Pay de queso $23.00 c/u
f. Nieve $18.50 c/u
El cliente debe elegir algún producto del menú y la cantidad que adquirió de este. Deberá mostrar el nombre del restaurante, el subtotal a pagar, calcular un iva del 16% sobre el subtotal. Mostrar el total ya con iva. Según el total a pagar deberá dar una propina, si el consumo es de 10 a 100 pesos, la propina es del 5%, si es más de 100 a 200, la propina es del 10%, si es mayor a 200 la propina es del 15%.
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
program RestauranteComidaMexicana;
uses crt;
var producto : integer;
var cantidad, iva, precio, propina, subtotal : real;
var total : real;
begin
write ('Ingresa el valor de cantidad: ');
readln (cantidad);
writeln ('Selecciona el valor de producto.');
writeln (' 1.- Sodas lata $15.50');
writeln (' 2.- Agua de sabor $25.00');
writeln (' 3.- Orden de burritos $80.50');
writeln (' 4.- Sopes $25.60');
writeln (' 5.- Pay de queso $23.00');
writeln (' 6.- Nieve $18.50');
write (' : ');
repeat
readln (producto);
if (producto<1) or (producto>6) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (producto>=1) and (producto<=6);
precio := 0;
propina := 0;
if producto=1 then
begin
precio := 15.5;
end;
if producto=2 then
begin
precio := 25;
end;
if producto=3 then
begin
precio := 80.5;
end;
if producto=4 then
begin
precio := 25.6;
end;
if producto=5 then
begin
precio := 23;
end;
if producto=6 then
begin
precio := 18.5;
end;
subtotal := precio*cantidad;
iva := subtotal*0.16;
total := subtotal+iva;
if (total>=10) and (total<=100) then
begin
propina := total*0.05;
end;
if (total>100) and (total<=200) then
begin
propina := total*0.1;
end;
if total>200 then
begin
propina := total*0.15;
end;
writeln ('Valor de iva: ', iva:0:6);
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de propina: ', propina:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln ('Valor de total: ', total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var producto : integer;
var cantidad, iva, precio, propina, subtotal : real;
var total : real;
begin
write ('Ingresa el valor de cantidad: ');
readln (cantidad);
writeln ('Selecciona el valor de producto.');
writeln (' 1.- Sodas lata $15.50');
writeln (' 2.- Agua de sabor $25.00');
writeln (' 3.- Orden de burritos $80.50');
writeln (' 4.- Sopes $25.60');
writeln (' 5.- Pay de queso $23.00');
writeln (' 6.- Nieve $18.50');
write (' : ');
repeat
readln (producto);
if (producto<1) or (producto>6) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (producto>=1) and (producto<=6);
precio := 0;
propina := 0;
if producto=1 then
begin
precio := 15.5;
end;
if producto=2 then
begin
precio := 25;
end;
if producto=3 then
begin
precio := 80.5;
end;
if producto=4 then
begin
precio := 25.6;
end;
if producto=5 then
begin
precio := 23;
end;
if producto=6 then
begin
precio := 18.5;
end;
subtotal := precio*cantidad;
iva := subtotal*0.16;
total := subtotal+iva;
if (total>=10) and (total<=100) then
begin
propina := total*0.05;
end;
if (total>100) and (total<=200) then
begin
propina := total*0.1;
end;
if total>200 then
begin
propina := total*0.15;
end;
writeln ('Valor de iva: ', iva:0:6);
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de propina: ', propina:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln ('Valor de total: ', total:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.