jueves, 11 de diciembre de 2008

Proyecto

Villarreal Felix Carlos
Cornejo Cira Joel



Introducción
En este trabajo indica sobre la elaboración, función y aplicación del proyecto de programación que es una aplicación utilizando los conceptos y ejemplos que miramos en clase y en laboratorio.



Funcionamiento
El proyecto consiste en un convertidor de unidades en visual que convierte unidades de longitud, superficie, masa y volúmenes. Utilizamos visual por que da una mejor presentación al proyecto, para su elaboración contamos con 42 buttons, cuatro check box, un text box y cinco labels.
Básicamente lo que hace el programa es elegir una opción de algún check box de las unidades con las unidades que se desea trabajar, después se introduce al text box la cantidad a convertir luego se presiona uno de los 42 botones donde indica de que el valor que eligió y a que valor lo desea convertir y despliega el resultado en un label.



Aplicación.


Su aplicación se da en cualquier materia que se utilicen unidades, cuando se desea convertir una unidad de un sistema a otro ya que no se puede trabajar con unidades de distinto sistema o cuando se desea saber a cuanto equivaldría cierta cantidad de material a utilizar a otro sistema.






lunes, 8 de diciembre de 2008

Practica 14

Arreglo



using System;
using System.Collections.Generic;
using System.Text;
namespace Practica14c
{
class Arreglo
{
int[] calificasion ={89,95,75,83,99,86,75,79,82,73 };
int[] desviacion;
public Arreglo(int N)
{
desviacion = new int[N];
}
public int suma(int N)
{
int s = 0; int I;
for (I = 0; I < s =" s" suma1 =" suma(N);" p =" promedio(N);" i =" 0;" i =" 0;">

Console


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

namespace Practica14c
{
class Program
{
static void Main(string[] args)
{Arreglo A=new Arreglo(10);
A.desv(10);
A.impimir(10);
Console.ReadLine();
}
}
}


Visual
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Practica14v
{
public partial class Form1 : Form
{
double[] p;
double[] calificasion= { 89, 95, 75, 83, 99, 86, 75, 79, 82, 73 };
double [] desviacion;
double suma;
int I;
public Form1()
{
InitializeComponent();
desviacion = new double[10];
p = new double[10];
}
private void Salir_Click(object sender, EventArgs e)
{
Close();
}
private void Calcular_Click(object sender, EventArgs e)
{
list.Items.Add("Calificacion Desviacion ");
suma = suma + 89 + 95 + 75 + 83 + 99 + 86 + 75 + 79 + 82 + 73;
for (I = 0; I < 10; I++)
{
p[I] = 836/ 10;
desviacion[I] = calificasion[I] - p[I];
list.Items.Add(" "+calificasion[I]+" "+desviacion[I]);
}

}
private void Limpiar_Click(object sender, EventArgs e)
{
list.Items.Clear();
}
}
}

miércoles, 26 de noviembre de 2008

Practica 13

Problema 1
using System;
using System.Collections.Generic;
using System.Text;
namespace Practica13
{
class Program
{
static void Main(string[] args)
{
Arreglo A1 = new Arreglo(5);
int I, dato;
for (I = 0; I <>
{
Console.Write("Introduce dato {0}:",(I + 1));
dato = int.Parse(Console.ReadLine()); A1.insertardato(I, dato); }
Console.WriteLine("\nLa suma es: {0}",A1.sumadatos(5));
Console.WriteLine("El dato mayor es: {0}", A1.mayor(5));
Console.WriteLine("El dato menor es: {0}", A1.menor(5));
Console.WriteLine("El promedio es: {0} ", A1.promedio(5));
Console.ReadLine(); } } }





using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Practica13v
{
public partial class Calcular : Form
{

double[] dato ;
double may, men,suma, promedio;
int I;
public Calcular()
{
InitializeComponent();
dato = new double [5];
I = 0;
}
private void tdato_Click(object sender, EventArgs e)
{
if (I <>
suma = suma + dato[I];
promedio = suma / 5;
tbd.Clear(); I++;
if (I == 5) { tbd.Enabled = false;
} } }
private void button1_Click(object sender, EventArgs e)
{ may = dato[0];
for (I = 0; I <> may)
{ may = dato[I]; }
}
men = dato[0];
for (I = 0; I <>
{ if ( dato[I]< men =" dato[I];">
} } label2.Text = ("La suma es: " + suma.ToString());
label3.Text = ("El dato mayor es: " + may.ToString());
label4.Text = ("El dato menor es: " + men.ToString());
label5.Text = ("El promedio es: " + promedio.ToString());
} private void Limpiar_Click(object sender, EventArgs e)
{ tbd.Clear(); tbd.Enabled = true;
label2.Text = ""; label3.Text = "";
label4.Text = ""; label5.Text = "";
} } }

martes, 18 de noviembre de 2008

Practica 12



Problema 1

using System;
using System.Collections.Generic;
using System.Text;
namespace Practica12_problema_1c
{
class Program
{
static void Main(string[] args)
{int I;
double[] corriente = new double[10];
double[] voltaje = new double[10];
double[] resistencia = new double[10];
for(I=0; I<10; I++)
{
Console.Write("introduce valor de resistencia {0}:",I+1);
resistencia[I] =double.Parse (Console.ReadLine());
}
Console.WriteLine("");
for (I = 0; I < 10; I++)
{
Console.Write("Introduce corriente {0}:",I+1);
corriente[I] = double.Parse(Console.ReadLine());
voltaje[I] = (corriente[I] * resistencia[I]);
}
Console.WriteLine("\n\tCorriente "+"Resisntecia "+" Voltios");
for (I = 0; I < 10; I++)
{
Console.WriteLine("\t "+corriente[I]+" "+resistencia[I]+" "+voltaje[I]);
}
Console.ReadLine();
}
}
}


lunes, 10 de noviembre de 2008

Practica 11

Problema1
using System;
using System.Collections.Generic;
using System.Text;
namespace Practica11_problema_1c
{
class Program
{
static void Main(string[] args)
{
double e, R, suma, promedio, r;
for (e = 1; e <= 4; e = e + 1) { Console.WriteLine("\nExperimento " + e);
suma = 0; for (R = 1; R <= 6; R = R + 1)
{
Console.Write("Introdusca el resultado {0}:", R);
r = double.Parse(Console.ReadLine()); suma = suma + r;
}
promedio = suma / 6;
Console.WriteLine("\nSu promedio de ensaye es:" + promedio);
Console.ReadLine(); } } } }



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Practica11_problema_1v
{
public partial class Form1 : Form
{
double[] n1;
double[] n2;
double[] n3;
double[] n4;
double[] n5;
double[] n6;
double[] suma;
double[] promedio;
int I=0;
public Form1()
{
InitializeComponent();
n1 = new double[6];
n2 = new double[6];
n3 = new double[6];
n4 = new double[6];
n5 = new double[6];
n6 = new double[6];
suma= new double[4];
promedio=new double[4];
}
private void Calcular_Click(object sender, EventArgs e)
{
for (I = 0; I < i =" I">

{ list.Items.Add ( "El experimento "+( I ));

list.Items.Add ("La suma es: " + suma[I]);

list.Items.Add ("El promedio es:" + promedio[I]);

list.Items.Add("");

} } private void Limpiar_Click(object sender, EventArgs e)

{ tbn2.Clear();

tbn3.Clear();

tbn4.Clear();

tbn5.Clear();

tbn6.Clear();

tbn1.Clear();

tbn1.Text = "0";

tbn2.Text = "0";

tbn3.Text = "0";

tbn4.Text = "0";

tbn5.Text = "0";

tbn6.Text = "0";

label7.Text = "";

label8.Text = "";

tbn1.Enabled = true;

tbn2.Enabled = true;

tbn3.Enabled = true;

tbn4.Enabled = true;

tbn5.Enabled = true;

tbn6.Enabled = true;

list.Items.Clear();

}

private void Salir_Click(object sender, EventArgs e)

{ Close(); }

private void Dato_Click(object sender, EventArgs e)

{ if (I <>

{ n1[I] = double.Parse(tbn1.Text);

n2[I] = double.Parse(tbn2.Text); n3[I] = double.Parse(tbn3.Text); n4[I] = double.Parse(tbn4.Text);

n5[I] = double.Parse(tbn5.Text); n6[I] = double.Parse(tbn6.Text);

suma[I] = n1[I] + n2[I] + n3[I] + n4[I] + n5[I] + n6[I];

promedio[I] = suma[I] / 6;

tbn1.Clear();

tbn2.Clear();

tbn3.Clear();

tbn4.Clear();

tbn5.Clear();

tbn6.Clear();

I++; } if (I == 4) { tbn1.Enabled = false;

tbn2.Enabled = false;

tbn3.Enabled = false; tbn4.Enabled = false;

tbn5.Enabled = false; tbn6.Enabled = false; } } } }




Problema2

using System;
using System.Collections.Generic;
using System.Text;
namespace Practica11problema_2c
{
class Program
{
static void Main(string[] args)
{
double sumag, G, V, sumavol,voltaje,promg,prom;
sumag=0;
Console.Write("introduce el voltaje para los generadores");
for(G=1; G<=6; G=G+1)
{
sumavol=0;
Console.WriteLine("\n"+G+"Generador");
for(V=1; V<=3; V=V+1)
{
Console.Write("introduce voltaje{0}:",V);
voltaje=double.Parse(Console.ReadLine());
sumavol=sumavol+voltaje; } prom = sumavol / 3;
sumag = sumag + prom;
Console.WriteLine("\nSu voltaje promedio es: "+prom);
} promg = sumag / 5;
Console.Write("El promedio de voltaje de todos los generadores es: ");
Console.WriteLine(""+promg);
Console.ReadLine();
} } }

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Prcatica11_problema_2v
{
public partial class Form1 : Form
{
double[] v1;
double[] v2;
double[] v3;
double[] volprom;
double[] sumavol;
double[] dato;
int I;
public Form1()
{
InitializeComponent();
v1 = new double[5];
v2 = new double[5];
v3 = new double[5];
dato = new double[5];
volprom = new double[5];
sumavol = new double[5];
I = 0;
}
private void Calcular_Click(object sender, EventArgs e)
{
for (I = 0; I < i =" I">
{
list.Items.Add("Generador:" + dato[I]);
list.Items.Add("El voltaje promedio es:" + volprom[I]);
list.Items.Add("" );
} } private void Salir_Click(object sender, EventArgs e)
{ Close();
} private void Limpiar_Click(object sender, EventArgs e) { tbv1.Clear(); tbv2.Clear(); tbv3.Clear(); tbv1.Text = ""; tbv2.Text = "";
tbv3.Text = "";
list.Items.Clear(); tbv1.Enabled = true;
tbv2.Enabled = true;
tbv3.Enabled = true; }
private void Dato_Click(object sender, EventArgs e)
{ if (I <>
v2[I] = double.Parse(tbv2.Text);
v3[I] = double.Parse(tbv3.Text);
sumavol[I] = v1[I] + v2[I] + v3[I];
volprom[I] = sumavol[I] / 3;
dato[I]=I+1;
tbv1.Clear(); tbv2.Clear();
tbv3.Clear(); I++; } if (I == 5)
{ tbv1.Enabled = false; tbv2.Enabled = false;
tbv3.Enabled = false; } } } }




Problema3
using System;
using System.Collections.Generic;
using System.Text;
namespace Practica11_problema_3c
{
class Program
{
static void Main(string[] args)
{
int mayor, posmayor, menor, posmen, suma = 0, prom;
int[] Elementos = new int[5];
int I;
Console.WriteLine("Introduce siguientes valores");
for (I = 0; I < mayor =" Elementos[0];" posmayor =" 0;" i =" 1;"> mayor)
{
mayor = Elementos[I];
posmayor = I;
}
}
Console.WriteLine("\nEl dato mayor es: " + mayor);
Console.WriteLine("Su posicion es: " + posmayor);
menor = Elementos[0];
posmen = 0;
for (I = 1; I <>
{ menor = Elementos[I]; posmen = I; }
}
Console.WriteLine("\nEl dato menor es: " + menor);
Console.WriteLine("Su posicion es: " + posmen);
suma = 0; for (I = 0; I <>
suma = suma + Elementos[I];
}
prom = suma / 5;
Console.WriteLine("El promedio de los elementos es: " + prom);
Console.ReadLine();
} } }



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Practica11_problema_3v
{
public partial class Form1 : Form
{
double suma;
double prom;
double[] x; int I;
public Form1()
{
InitializeComponent();
x = new double[10];
I = 0;
suma = 0;
}
private void Calcular_Click(object sender, EventArgs e)
{
double mayor = x[0];
double posmay = 0;
double menor = x[0];
double posmen = 0;
mayor = x[0];
for (I = 1; I <> mayor)
{ mayor = x[I];
posmay = I+1;
}
}
menor = x[0];
for (I = 1; I <>
{
if (x[I] <>
{
menor = x[I]; posmen = I+1;
} }
label2.Text = "El dato menor es " + menor.ToString() + " su pososcion es " + posmen.ToString(); label3.Text = "El dato mayor es " + mayor.ToString() + " su posicion es " + posmay.ToString(); { label4.Text = "Su promedio es " + prom.ToString();
} } private void button1_Click(object sender, EventArgs e) { if (I <>
{ x[I] = double.Parse(tbx.Text);
suma = suma + x[I]; prom = suma / 10;
tbx.Clear(); I++;
if (I == 10) { tbx.Enabled = false;
} } } private void Limpiar_Click(object sender, EventArgs e)
{ tbx.Clear();
tbx.Text = "0";
label2.Text = "";
label3.Text = "";
label4.Text = "";
tbx.Enabled = true;
} private void Salir_Click(object sender, EventArgs e)
{ Close();
} } }

martes, 4 de noviembre de 2008

Practica 10

Problema 1

using System;
using System.Collections.Generic;
using System.Text;
namespace Examen_1al_99
{
class Program
{
static void Main(string[] args)
{
double I;
Console.WriteLine("Numero" + " Cuadrado");
for (I = 1; I <= 99; I = I + 2)
{
Console.WriteLine("" + I + "\t " + I * I);
}
Console.ReadLine();
}
}
}













Problema 2

using System;
using System.Collections.Generic;
using System.Text;
namespace Examen_xy
{
class Program
{
static void Main(string[] args)
{
double x, y;
Console.WriteLine("X" + " \t Y");
for (x = 5; x <= 10; x = x + 0.02)
{ y = (3 * x * x * x - 2 * x * x + x);
Console.WriteLine("" + x + " \t " + y); }
Console.ReadLine();
}
}
}








Problema 3

using System;
using System.Collections.Generic;
using System.Text;
namespace Examen_2_al_200
{
class Program
{
static void Main(string[] args)
{
double I, suma;
suma = 0;
for (I = 2; I <= 200; I = I + 2)

{ suma = suma + I; if (I >= 200)
{
Console.WriteLine("La suma es: {0}", suma);
}
}
Console.ReadLine();
}
}
}














Problema 4

using System;
using System.Collections.Generic;
using System.Text;
namespace Examen_grados
{
class Program
{
static void Main(string[] args)
{
double vinicial, vfinal, celcius, I;
Console.WriteLine("Introduce la temperatura inicial en grados fahrenheit");
vinicial = double.Parse(Console.ReadLine());
Console.WriteLine("Introduce el valor final en grados fahrenheit");
vfinal = double.Parse(Console.ReadLine());
Console.WriteLine("\nFahrenheit" + "\t Celcius");
for (I = vinicial; I <= vfinal; I = I + 2) { celcius = (5.0 / 9.0) * (I - 32);
Console.WriteLine("" + I + " " + celcius); }
Console.ReadLine();
}
}
}








jueves, 30 de octubre de 2008

Practica9

Problema1

1.-Escriba un programa en C# para convertir grados celsius a fahrenheit.El programa debe solicitar el valor inicial en grados celsius, la cantidad de conversiones que se efectuarán y el incremento entre los valores en grados celsius. La pantalla debe tener los encabezados apropiados y una lista con los valores en grados celsius y los correspondientes en grados fahrenheit. Utilice la siguiente relaciónfahrenheit=(9.0/5.0)*celsius + 32.0

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Practica9_problema_1c
{
class Program
{
static void Main(string[] args)
{
double vinicial, n, inc,celcius,I,fahrenheit;
Console.WriteLine("Introduce el valor inicial en grados celcius");
vinicial = double.Parse(Console.ReadLine());
Console.WriteLine("Introduce la cantidad de conversiones");
n=double.Parse(Console.ReadLine());
Console.WriteLine("Introduce el los imcremntos entre los grados celcius");
inc=double.Parse(Console.ReadLine());
celcius=vinicial;
Console.WriteLine("\n Celcius " + " Fahrenheit");
for (I = 1; I <= n; I = I + 1)

{ fahrenheit = (9.0 / 5.0) * (celcius + 32);

Console.WriteLine( " "+celcius + " "+fahrenheit);

celcius = celcius + inc; }

Console.ReadLine(); } } }




-----------------------------------------------------------------------------------------------
Problema2

2.-Haga un programa que permita leer un valor N, luego que lea N numeros de entrada(utilizando un ciclo) imprimir el total, el promedio y el dato mayor.

using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
double n, suma, i, mayor, valor;
Console.WriteLine("introdusca la cantidad de valores en procesar");
n = double.Parse(Console.ReadLine());
suma = mayor = 0;
for (i = 1; i <= n; i = i + 1) { Console.WriteLine("\nintroduce valor"); valor = double.Parse(Console.ReadLine()); suma = suma + valor; if (valor > mayor)
{
mayor = valor;
}




else




{mayor=n




}
Console.WriteLine("la suma es {0}", suma);
Console.WriteLine("el promedio es{0}", suma / n);
Console.WriteLine("el dato mayor es{0}", mayor);
}
Console.ReadLine();


}
}
}






--------------------------------------------------------------------------
Problema3
3.-Elaborar un programa que permita leer un número N y que imprima un triángulo de asteriscos, por ejemplo si el valor leido es 5, imprimir***************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Practica9_problema_3c
{
class Program
{
static void Main(string[] args)
{
int n, i, j;
Console.WriteLine("introduce el valor n");
n = int.Parse(Console.ReadLine());
for (i = 1; i <= n; i = i + 1)

{

Console.Write("\n"); for (j = 1; j <= i; j = j + 1)

{

Console.Write("*");

}

}

Console.ReadLine(); } } }


--------------------------------------------------------------------------
Problema4
4.-Una pelota de golf se lanza desde un aeroplano. La distancia, d, que la pelota cae en t segundos está dada por la ecuación d=(1.0/2.0)*g*t*t, donde g es la acelaración producida por la gravedad y es igual a 32 pies/seg2. Utilizando esta información, escriba un programa que muestre la distancia que la pelota cae en cada intervalo de un segundo durante diez segundos y la distancia total que la pelota ha recorrido al final de cada intervalo. La salida debe completar la sig. tabla:Tiempo

-----Distancia en el----------Distancia-----------intervalo actual---------total0--------------------------0.0--------------------0.01-----------------16.0------------ ---16.0...10
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Practica9_problema_4c
{
class Program
{
static void Main(string[] args)
{double T,distancia,dt;
Console.WriteLine("\tTiempo"+" Distancia entre el"+" Distancia total");
Console.WriteLine("\t " + " intervalo actual" + " total");
dt = 0;
for (T = 1; T <= 10; T = T + 1) { distancia = (1.0 / 2.0) * 32 * T * T;




Console.WriteLine(" \t "+T + " "+ distancia + " "+ dt); dt = dt + distancia; }




Console.ReadLine();




}

}

}