Arte republicano
1.- construir un programa que permita ingresar 5 números enteros positivos y que determine cual de ellos es el mayor y cual es el menor.
Sol.
OBJETO | PROPIEDAD | VALOR |
Form 1 | Caption | Calculo del mayor y menor número |
| Color | clSkyBlue |
Label 1 | Caption | Primer número |
Label 2 | Caption | Segundo número |
Label 3 | Caption | Tercernúmero |
Label 4 | Caption | Cuarto número |
Label 5 | Caption | Quinto número |
Label 6 | Caption | Mayor número |
Label 7 | Caption | Menor número |
Edit 1 | Name | pnum |
| Text | |
Edit 2 | Name | snum |
| Text | |
Edit 3 | Name | tnum |
| Text | |
Edit 4 | Name | cnum |
| Text | |
Edit 5 | Name | qnum |
| Text | |
Edit 6 | Name | manum |
| Text | |Edit 7 | Name | menum |
| Text | |
Button 1 | Caption | &Nuevo |
Button 2 | Caption | &Calcular |
Button 3 | Caption | &Salir |
Código
En el Botón Nuevo
pnum->Clear();
snum->Clear();
tnum->Clear();
cnum->Clear();
qnum->Clear();
manum->Clear();
menum->Clear();
En el Botón Calcular
int mayor, menor, p, s, t, c, q;
mayor=0;menor=99999999;
p=StrToInt(pnum->Text);
s=StrToInt(snum->Text);
t=StrToInt(tnum->Text);
c=StrToInt(cnum->Text);
q=StrToInt(qnum->Text);
if (p>mayor)
mayor=p;
if (s>mayor)
mayor=s;
if (t>mayor)
mayor=t;
if (c>mayor)
mayor=c;
if (q>mayor)
mayor=q;
if (p<menor)
menor=p;
if (s<menor)
menor=s;
if (t<menor)
menor=t;
if (c<menor)
menor=c;
if(q<menor)
menor=q;
manum->Text=IntToStr(mayor);
menum->Text=IntToStr(menor);
En el botón Nuevo
Close ();
2.- Diseñe un programa que determine la categoría de un estudiante en base a su promedio, de acuerdo a la siguiente tabla:
PROMEDIO | CATEGORIA |
20-17 | A |
16-14 | B |
13-12 | C |
11-0 | D |
Sol.
objeto | propiedad | valor |
Form 1 | Caption | Calculo decategoría según promedio |
| Color | clskyblue |
Label 1 | Caption | Promedio |
Label 2 | Caption | categoría |
Edit 1 | Name | pro |
| Text | |
Edit 2 | Name | cat |
| Text | |
Button 1 | Caption | &Nuevo |
button 2 | Caption | &Categoria |
button 3 | Caption | &Salir |
Código
En el botón Nuevo
pro->Clear();
cat->Clear();
En el botónCategoría
int p;
String c;
p=StrToInt(pro->Text);
c=StrToStr(cat->Text);
if (p>16)
c='A';
else if (p>13)
c='B';
else if (p>11)
c='C';
else if (p>=0)
c='D';
cat->Text=StrToStr(c);
En el botón Salir
Close ();
3.- Una empresa de bines y raíces ofrece casas de interés social bajo las siguientes condiciones: si el ingreso mensual del comprador es menos de S/.2250la cuota inicial será igual al 15% del costo de la casa y el resto se distribuirá en 120 cuotas mensuales. Si el ingreso mensual del comprador es mayor o igual a S/.2250 la cuota inicial será igual al 30% del costo de la casa y el resto se distribuirá en 75 cuotas mensuales. Diseñe un programa que permita determinar cuanto debe pagar un comprador por concepto de cuota inicial y cuanto por cadacuota mensual.
Sol.
OBJETO | PROPIEDAD | VALOR |
Form 1 | Caption | Pago inicial y mensual de una casa |
| Color | clskyblue |
Label 1 | Caption | Costo de la casa S/ |
Label 2 | Caption | Ingreso mensual del comprador |
Label 3 | Caption | Cuota inicial |
Label 4 | Caption | Cuotas de |
Edit 1 | Name | costocas |
| Text | |
edit 2 | Name | ingmen |
| Text | |
edit 3| Name | cuotai |
| Text | |
edit 4 | Name | cuotasm |
| Text | |
edit 5 | Name | preciom |
| Text | |
Button 1 | Caption | &Nuevo |
Button 2 | Caption | &Calcular |
Button 3 | Caption | &salir |
Código
en el botón Nuevo
costocas->Clear();
ingmen->Clear();
cuotai->Clear();
cuotasm->Clear();
preciom->Clear();
en el botón Calcular...
Regístrate para leer el documento completo.