-
Lenguaje
Pascal
-
Descripción
Ingresar el nombre del cliente y seleccione un tipo de equipo como:
1.- Laptop
2.- Móvil
3.- Tablet
Luego ingrese el precio y cantidad del equipo. Así mismo, se obtendrá un descuento a partir de la compra de 4 equipos a más.
Condicionar:
- Si el equipo es Laptop tendrá un descuento de 15%,
- Si es Móvil su descuento es de 10%
- Si es Tablet su descuento es de 12%.
Hallar el descuento y el monto de pago.
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 DescuentosPorTipoDeEquipo;
uses crt;
var tipo_de_equipo : integer;
var cantidad, descuento, importe_a_pagar, precio, subtotal : real;
var nombre_del_cliente : string;
begin
write ('Ingresa el nombre del cliente: ');
readln (nombre_del_cliente);
write ('Ingresa el valor de cantidad: ');
readln (cantidad);
write ('Ingresa el valor de precio: ');
readln (precio);
writeln ('Selecciona el valor de tipo de equipo.');
writeln (' 1.- Laptop');
writeln (' 2.- M'#162'vil');
writeln (' 3.- Tablet');
write (' : ');
repeat
readln (tipo_de_equipo);
if (tipo_de_equipo<1) or (tipo_de_equipo>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_equipo>=1) and (tipo_de_equipo<=3);
subtotal := precio*cantidad;
descuento := 0;
if (cantidad>=4) and (tipo_de_equipo=1) then
begin
descuento := subtotal*0.15;
end;
if (cantidad>=4) and (tipo_de_equipo=2) then
begin
descuento := subtotal*0.1;
end;
if (cantidad>=4) and (tipo_de_equipo=3) then
begin
descuento := subtotal*0.12;
end;
importe_a_pagar := subtotal-descuento;
writeln ('Nombre del cliente: ', nombre_del_cliente);
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de importe a pagar: ', importe_a_pagar:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var tipo_de_equipo : integer;
var cantidad, descuento, importe_a_pagar, precio, subtotal : real;
var nombre_del_cliente : string;
begin
write ('Ingresa el nombre del cliente: ');
readln (nombre_del_cliente);
write ('Ingresa el valor de cantidad: ');
readln (cantidad);
write ('Ingresa el valor de precio: ');
readln (precio);
writeln ('Selecciona el valor de tipo de equipo.');
writeln (' 1.- Laptop');
writeln (' 2.- M'#162'vil');
writeln (' 3.- Tablet');
write (' : ');
repeat
readln (tipo_de_equipo);
if (tipo_de_equipo<1) or (tipo_de_equipo>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_equipo>=1) and (tipo_de_equipo<=3);
subtotal := precio*cantidad;
descuento := 0;
if (cantidad>=4) and (tipo_de_equipo=1) then
begin
descuento := subtotal*0.15;
end;
if (cantidad>=4) and (tipo_de_equipo=2) then
begin
descuento := subtotal*0.1;
end;
if (cantidad>=4) and (tipo_de_equipo=3) then
begin
descuento := subtotal*0.12;
end;
importe_a_pagar := subtotal-descuento;
writeln ('Nombre del cliente: ', nombre_del_cliente);
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de importe a pagar: ', importe_a_pagar:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.