-
Lenguaje
Pascal
-
Descripción
Si se sabe que en una empresa de artefactos se tiene especificado los productos por categoría:
La categoría A cuesta 1300.
La categoría B cuesta 950.
La categoría C cuesta 800.
La categoría D cuesta 500.
La categoría E cuesta 200.
Además se sabe que a todo producto se le va agregar un descuento del 10%. También se sabe que hay que tener en cuenta que este sistema está programado para vender 2 productos. Saque el total de la cuenta.
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
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
program EmpresaDeArtefactos;
uses crt;
var categoria, i : integer;
var costo, descuento, total_de_la_cuenta : real;
begin
total_de_la_cuenta := 0;
for i:=1 to 2 do
begin
writeln ('PROCESO ', i);
writeln ('Selecciona el valor de categoria.');
writeln (' 1.- A');
writeln (' 2.- B');
writeln (' 3.- C');
writeln (' 4.- D');
writeln (' 5.- E');
write (' : ');
repeat
readln (categoria);
if (categoria<1) or (categoria>5) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (categoria>=1) and (categoria<=5);
costo := 0;
if categoria=1 then
begin
costo := 1300;
end;
if categoria=2 then
begin
costo := 950;
end;
if categoria=3 then
begin
costo := 800;
end;
if categoria=4 then
begin
costo := 500;
end;
if categoria=5 then
begin
costo := 200;
end;
descuento := costo*0.1;
total_de_la_cuenta := total_de_la_cuenta+costo-descuento;
writeln ('Valor de costo: ', costo:0:6);
writeln ('Valor de descuento: ', descuento:0:6);
writeln;
end;
writeln ('Valor de total de la cuenta: ', total_de_la_cuenta:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var categoria, i : integer;
var costo, descuento, total_de_la_cuenta : real;
begin
total_de_la_cuenta := 0;
for i:=1 to 2 do
begin
writeln ('PROCESO ', i);
writeln ('Selecciona el valor de categoria.');
writeln (' 1.- A');
writeln (' 2.- B');
writeln (' 3.- C');
writeln (' 4.- D');
writeln (' 5.- E');
write (' : ');
repeat
readln (categoria);
if (categoria<1) or (categoria>5) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (categoria>=1) and (categoria<=5);
costo := 0;
if categoria=1 then
begin
costo := 1300;
end;
if categoria=2 then
begin
costo := 950;
end;
if categoria=3 then
begin
costo := 800;
end;
if categoria=4 then
begin
costo := 500;
end;
if categoria=5 then
begin
costo := 200;
end;
descuento := costo*0.1;
total_de_la_cuenta := total_de_la_cuenta+costo-descuento;
writeln ('Valor de costo: ', costo:0:6);
writeln ('Valor de descuento: ', descuento:0:6);
writeln;
end;
writeln ('Valor de total de la cuenta: ', total_de_la_cuenta:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.