20091124

EXTRA UNIDAD 2 (1) PROMEDIOS (visual)



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int n;
double prom = 0.0;
int total = 0;
int suma = 0;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (n != 9999)
{
n = int.Parse(textBox1.Text);
listBox1.Items.Add("VALOR NUMERICO " + n.ToString());
suma = suma + n;
total = total + 1;
textBox1.Clear();
}
else
{
prom = suma / total;
listBox1.Items.Add("EL PROMEDIO ES : " + prom.ToString());
textBox1.Enabled = false;
button1.Enabled = false;
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
listBox1.Items.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}

EXTRA UNIDAD 2 (1) PROMEDIO DE N NUMEROS (consola)

pseudocodigo.
inicio

int n;
double prom = 0.0;
int total = 0;
int suma = 0;
int suma1 = 0;

do
print"INTRODUCE VALOR NUEMRICO"
Read n
suma = suma + n
total = total + 1
}
while n != 9999
{

prom = (suma) / (total);
}

print "ELPROMEDIO RESULTANTE ES" , prom
}
fin












using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int n;
double prom = 0.0;
int total = 0;
int suma = 0;
int suma1 = 0;

do
{
Console.WriteLine("INTRODUCE VALOR NUEMRICO");
n = int.Parse(Console.ReadLine());
suma = suma + n;
total = total + 1;
}
while (n != 9999);
{

prom = (suma) / (total);
}

Console.WriteLine("ELPROMEDIO RESULTANTE ES : {0}", prom);
Console.ReadKey();
}
}
}

20091120

EXTRA UNIDAD 2 (2) NUMEROS ROMANOS (visual)



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{

InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
int numero;




numero=int.Parse(textBox1.Text);

switch (numero)
{
case 0: Console.WriteLine("exit");
break;

case 1: textBox2.Text=("su equivalente en romano es I");
break;
case 2: textBox2.Text = ("su equivalente en romano es II");
break;
case 3: textBox2.Text = ("su equivalente en romano es III");
break;
case 4: textBox2.Text = ("su equivalente en romano es IV");
break;
case 5: textBox2.Text = ("su equivalente en romano es V");
break;
case 6: textBox2.Text = ("su equivalente en romano es VI");
break;
case 7: textBox2.Text = ("su equivalente en romano es VII");
break;
case 8: textBox2.Text = ("su equivalente en romano es VIII");
break;
case 9: textBox2.Text = ("su equivalente en romano es IX");
break;
case 10: textBox2.Text = ("su equivalente en romano es X");
break;


default: Console.WriteLine("No Se introdujo numero correcto");

break;

}
}

private void textBox2_TextChanged(object sender, EventArgs e)
{

}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();

}

private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}

EXTRA UNIDAD 2 (2) NUMEROS ROMANOS

pseudocodigo.
inicio
do
{
print("IINTRODUCE VALOR ENTERO 1-10 Y 0 PARA SALIR" )
Read numero
switch(numero)
{
case 0:Console.WriteLine("EXIT" ); break;
case 1: print("SU EQUIVALENTE EN NUMERO ROMANO ES I") break;
case 2: print("SU EQUIVALENTE EN NUMERO ROMANO ES II") break;
case 3: print("SU EQUIVALENTE EN NUMERO ROMANO ES III") break;
case 4: print("SU EQUIVALENTE EN NUMERO ROMANO ES IV") break;
case 5: print("SU EQUIVALENTE EN NUMERO ROMANO ES V") break;
case 6: print("SU EQUIVALENTE EN NUMERO ROMANO ES VI") break;
case 7:print("SU EQUIVALENTE EN NUMERO ROMANO ES VII") break;
case 8: print("SU EQUIVALENTE EN NUMERO ROMANO ES VIII") break;
case 9:print("SU EQUIVALENTE EN NUMERO ROMANO ES IX");break;
case 10: print("SU EQUIVALENTE EN NUMERO ROMANO ES X") break;
default :print("error" ) break
}
}
while (numero != 0);
fin.






using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int numero ;
do
{
Console.WriteLine("IINTRODUCE VALOR ENTERO 1-10 Y 0 PARA SALIR" );
numero = int.Parse(Console.ReadLine());

switch(numero)

{
case 0:Console.WriteLine("EXIT" );
break;
case 1: Console.WriteLine("SU EQUIVALENTE EN NUMERO ROMANO ES I");
break;
case 2: Console.WriteLine("SU EQUIVALENTE EN NUMERO ROMANO ES II");
break;
case 3: Console.WriteLine("SU EQUIVALENTE EN NUMERO ROMANO ES III");
break;
case 4: Console.WriteLine("SU EQUIVALENTE EN NUMERO ROMANO ES IV");
break;
case 5: Console.WriteLine("SU EQUIVALENTE EN NUMERO ROMANO ES V");
break;
case 6: Console.WriteLine("SU EQUIVALENTE EN NUMERO ROMANO ES VI");
break;
case 7: Console.WriteLine("SU EQUIVALENTE EN NUMERO ROMANO ES VII");
break;
case 8: Console.WriteLine("SU EQUIVALENTE EN NUMERO ROMANO ES VIII");
break;
case 9: Console.WriteLine("SU EQUIVALENTE EN NUMERO ROMANO ES IX");
break;
case 10: Console.WriteLine("SU EQUIVALENTE EN NUMERO ROMANO ES X");
break;
default :Console.WriteLine("error" );
break;
}


}

while (numero != 0);
Console.ReadKey();
}
}
}

EXTRA UNIDAD 2 (3) PESOS DE LA PESCA (visual)



using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
double lim, peso, sum;
public Form1()
{
InitializeComponent();
sum = 0;
}
private void button2_Click(object sender, EventArgs e)
{
peso = double.Parse(textBox2.Text);
if (sum <>
{
sum = sum + peso;
listBox1.Items.Add("" + peso.ToString());
if (sum > lim)
{
listBox1.Items.Add("El limite ha excedido");
listBox1.Items.Add("EL PESO TOTAL ES " + sum.ToString());
}
if (sum == lim)
{
listBox1.Items.Add("ha llegado al limite");
listBox1.Items.Add("EL PESO TOTAL ES " + sum.ToString());
}
textBox2.Clear();
textBox2.Focus();
}
else
{
textBox2.Enabled = false;
button2.Enabled = false;
}
}
private void button5_Click(object sender, EventArgs e)
{
lim = double.Parse(textBox1.Text);
listBox1.Items.Add("Peso Individual");
textBox1.Enabled = false;
button5.Enabled = false;
textBox2.Focus();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
listBox1.Items.Clear();
button5.Enabled=true;
textBox1.Enabled = true;
}
private void button4_Click(object sender, EventArgs e)
{
Close();
}
}
}

EXTRA UNIDAD 2 (3) PESOS DE LA PESCA

pseudocodigo.
inicio
double lim, peso, sum;
sum = 0;
print "INTRODUCE EL LIMITE DE LA PESCA: "
Read lim
do
{
print "INTRODUCE EL PESO INDIVIDUAL: "
peso = double.Parse(Console.ReadLine());
sum = sum + peso;
if (sum > lim)
{
print "EL LIMITE HA EXCEDIDO"
print "EL PESO TOTAL ES ", sum
}
if (sum == lim)
{
print "HA LLEGADO AL LIMITE"
print("EL PESO TOTAL ES ", sum)





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double lim, peso, sum;
sum = 0;
Console.Write("INTRODUCE EL LIMITE DE LA PESCA: ");
lim = double.Parse(Console.ReadLine());
do
{
Console.Write("INTRODUCE EL PESO INDIVIDUAL: ");
peso = double.Parse(Console.ReadLine());
sum = sum + peso;
if (sum > lim)
{
Console.WriteLine("EL LIMITE HA EXCEDIDO");
Console.WriteLine("EL PESO TOTAL ES {0}", sum);
}
if (sum == lim)
{
Console.WriteLine("HA LLEGADO AL LIMITE");
Console.WriteLine("EL PESO TOTAL ES {0}", sum);
}
}
while (sum < lim && peso != 0);
Console.ReadLine();
}
}
}

20091117

PRACTICA 10.3 ARREGLO BIDIMENSIONAL(consola,visual)

Pseudocodigo.
REAL[,] voltajes=new double[3,5];
REAL c1 =0,c2=0,r=0,c=0,suma1=0,suma2=0;
for (r = 0 TO 3 r=r+1)
{
for (c = 0 TO 5; c= c+1)
{
PRINT "Voltajes [{0},{1}] : ", r, c
READ voltajes[r, c]

}

}
for (r = 0 TO 3; r=r+1)
{
for (c = 0 TO 5; c=c+1)
{
if (voltajes[r, c] < 60)
{
c1 = c1 + 1;


}
else
{
if (voltajes[r, c] >= 60)
{


c2 = c2 + 1;

}
}
}
}
PRINT "No. de Voltajes <60>=60 : {1}", c1,c2);
final .





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{

double[,] voltajes = new double[3, 5];
int SUMA1 = 0, SUMA2 = 0, r = 0, c = 0;
for (r = 0; r < 3; r++)
{ for (c = 0; c < 5; c++)
{ Console.Write("Voltajes [{0},{1}] : ", r, c);
voltajes[r, c] = double.Parse(Console.ReadLine());
} }
for (r = 0; r < 3; r++)
{ for (c = 0; c < 5; c++)
{ if (voltajes[r, c] < 60)
{ SUMA1 = SUMA1 + 1;
} else { if (voltajes[r, c] >= 60)
{
SUMA2 = SUMA2 + 1;
}}}}
Console.WriteLine("\n VOLTAJES MENORES DE 60 : {0}\n\n VOLTJES MAYORES DE 60 : {1}", SUMA1, SUMA2);
Console.ReadKey();
}
}
}

PRACTICA 10.3 ARREGLO BIDIMENSIONAL. (visual)


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int[,] voltaje = new int[3, 5];

int resistencia = 0;
int corriente = 0;
int c1 = 0, c2 = 0;
public Form1()
{


InitializeComponent();

listBox1.Items.Add("");


}

private void button1_Click(object sender, EventArgs e)
{if (resistencia < 3)
{ if (corriente < 5)
{ voltaje[resistencia, corriente] = int.Parse(textBox1.Text);
listBox1.Items.Add("Voltaje [" + resistencia.ToString() + "," + corriente.ToString() + "] : " + voltaje[resistencia, corriente].ToString());
corriente++;

textBox1.Clear();
}
else
{
resistencia++;
corriente = 0;

}

}


}
private void button2_Click_1(object sender, EventArgs e)
{
for (resistencia = 0; resistencia < 3; resistencia++)
{
for (corriente = 0; corriente < 5; corriente++)
{
if (voltaje[resistencia, corriente] < 60)
{
c1 = c1 + 1;

}
else
{if (voltaje[resistencia, corriente] >= 60)
{
c2 = c2 + 1;
}
}

}
}

textBox2.Text = ("Numero de Voltajes <60 es: " + c1.ToString());
textBox3.Text = ("Numero de Voltases >=60 es: " + c2.ToString());

}
private void button3_Click_1(object sender, EventArgs e)
{ textBox1.Clear();
listBox1.Items.Clear();
textBox2.Clear();
textBox3.Clear();

}

private void button4_Click(object sender, EventArgs e)
{
Close();

}
}
}