-
Lenguaje
Pascal
-
Descripción
Calcule el total a cancelar por un cliente en un almacén de llantas, sabiendo que si compra más de 2 llantas el precio es de $200,000 sino el precio es de $220,000.
Además, se le hace un descuento según su tipo de pago mostrando las siguientes opciones:
1. De contado en efectivo
2. De contado con tarjeta
3. Crédito
Si el pago es de contado en efectivo se le aplica el 8% de descuento, si es de contado con tarjeta el descuento es del 4% y si es a crédito no tiene descuento.
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
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
program AlmacenDeLlantas;
uses crt;
var tipo_de_pago : integer;
var descuento, numero_de_llantas, precio, subtotal : real;
begin
write ('Ingresa el valor de numero de llantas: ');
readln (numero_de_llantas);
writeln ('Selecciona el valor de tipo de pago.');
writeln (' 1.- De contado en efectivo');
writeln (' 2.- De contado con tarjeta');
writeln (' 3.- Cr'#130'dito');
write (' : ');
repeat
readln (tipo_de_pago);
if (tipo_de_pago<1) or (tipo_de_pago>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_pago>=1) and (tipo_de_pago<=3);
precio := numero_de_llantas>200000:220000;
subtotal := precio*numero_de_llantas;
descuento := 0;
if tipo_de_pago=1 then
begin
descuento := subtotal*0.08;
end;
if tipo_de_pago=2 then
begin
descuento := subtotal*0.04;
end;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var tipo_de_pago : integer;
var descuento, numero_de_llantas, precio, subtotal : real;
begin
write ('Ingresa el valor de numero de llantas: ');
readln (numero_de_llantas);
writeln ('Selecciona el valor de tipo de pago.');
writeln (' 1.- De contado en efectivo');
writeln (' 2.- De contado con tarjeta');
writeln (' 3.- Cr'#130'dito');
write (' : ');
repeat
readln (tipo_de_pago);
if (tipo_de_pago<1) or (tipo_de_pago>3) then
write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
until (tipo_de_pago>=1) and (tipo_de_pago<=3);
precio := numero_de_llantas>200000:220000;
subtotal := precio*numero_de_llantas;
descuento := 0;
if tipo_de_pago=1 then
begin
descuento := subtotal*0.08;
end;
if tipo_de_pago=2 then
begin
descuento := subtotal*0.04;
end;
writeln ('Valor de descuento: ', descuento:0:6);
writeln ('Valor de precio: ', precio:0:6);
writeln ('Valor de subtotal: ', subtotal:0:6);
writeln;
write ('Presiona una tecla para terminar . . . ');
readkey;
end.