viernes, 18 de diciembre de 2009

Examen Clases Visual


class empleados
{int ideempleado;
float pago;
int horas;
public empleados()
{
ideempleado = 0;
pago = 0.0f;
horas = 0;
}
public void asignaride(int noemp)
{
ideempleado = noemp;
}
public void asignarpago(float p)
{ pago = p; }

public void asignarhoras(int h)
{
horas = h;
}
public int obteneride()
{ return ideempleado; }
public float obtenerpago()
{return pago ;}
public int obtenerhoras()
{ return horas; }}
}


public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
empleados E1 = new empleados();
int id, hr;
float p1;

id = int.Parse(textBox1.Text);
E1.asignaride(id);

p1 = float.Parse(textBox2.Text);
E1.asignarpago(p1);


hr = int.Parse(textBox3.Text);
E1.asignarhoras(hr);
listBox1.Items.Add("Empleado 1");
listBox1.Items.Add("No Empleado=" + E1.obteneride() + "Pago Por Hora=" + E1.obtenerpago() + "Horas trabajadas " + E1.obtenerhoras());



}

private void button2_Click(object sender, EventArgs e)
{



empleados E2 = new empleados();
int id, hr;
float p1;

id = int.Parse(textBox1.Text);
E2.asignaride(id);

p1 = float.Parse(textBox2.Text);
E2.asignarpago(p1);


hr = int.Parse(textBox3.Text);
E2.asignarhoras(hr);
listBox2.Items.Add("Empleado 3");
listBox2.Items.Add("No Empleado=" + E2.obteneride() + "Pago Por Hora=" + E2.obtenerpago() + "Horas trabajadas " + E2.obtenerhoras());



}

private void button3_Click(object sender, EventArgs e)
{
empleados E3 = new empleados();

E3.asignaride(432);
E3.asignarpago(21.50f);
E3.asignarhoras(20);
listBox3.Items.Add("Empleado 3");
listBox3.Items.Add("No Empleado=" + E3.obteneride() + "Pago Por Hora=" + E3.obtenerpago() + "Horas trabajadas " + E3.obtenerhoras());

}

private void button4_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
listBox2.Items.Clear();
listBox3.Items.Clear();
}

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

Examen Clases Consola


class empleado
{int ideempleado;
float pago;
int horas;
public empleado()
{
ideempleado = 0;
pago = 0.0f;
horas = 0;
}
public void asignaride(int noemp)
{
ideempleado = noemp;
}
public void asignarpago(float p)
{ pago = p; }

public void asignarhoras(int h)
{
horas = h;
}
public int obteneride()
{ return ideempleado; }
public float obtenerpago()
{return pago ;}
public int obtenerhoras()
{ return horas; }}
}


class Program
{
static void Main(string[] args)
{
empleado E1 = new empleado();
int id, hr;
float p1;
Console.Write("Identificacion Empleado:");
id = int.Parse(Console.ReadLine());
E1.asignaride(id);
Console.Write("Pago Por Hora:");
p1 = float.Parse(Console.ReadLine());
E1.asignarpago(p1);
Console.Write("Horas Trabajadas:");
hr = int.Parse(Console.ReadLine());
E1.asignarhoras(hr);
Console.WriteLine("No Empleado= {0}, Pago Por Hora= {1}, Horas trabajadas {2}", E1.obteneride(), E1.obtenerpago(), E1.obtenerhoras());




empleado E2 = new empleado();

Console.Write("\t\n Identificacion empleado:");
id = int.Parse(Console.ReadLine());
E2.asignaride(id);
Console.Write("Pago Por Hora:");
p1 = float.Parse(Console.ReadLine());
E2.asignarpago(p1);
Console.Write("Horas Trabajadas");
hr = int.Parse(Console.ReadLine());
E2.asignarhoras(hr);
Console.WriteLine("no empleado= {0},pago por hora= {1},horas trabajadas= {2}", E2.obteneride(), E2.obtenerpago(), E2.obtenerhoras());



empleado E3 = new empleado();
E3.asignaride(432);
E3.asignarpago(21.50f);
E3.asignarhoras(20);

Console.Write("Empleado 3");
Console.WriteLine(" No Empleado= {0}, Pago por hora= {1}, Horas Trabajadas= {2}", E2.obteneride(), E2.obtenerpago(), E2.obtenerhoras());

Console.ReadLine();



}
}
}

jueves, 17 de diciembre de 2009

Practica 13.2 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 Clase_Estudiante_W
{
public partial class Form1 : Form
{
int C = 0, NOCONTROL=0;
float EXAMEN;

estudiante E1 = new estudiante();
public Form1()
{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)
{
CO.Focus();
NOCONTROL = int.Parse(CO.Text);
E1.INTRODUCEIDE(NOCONTROL);

C = int.Parse(MA.Text);

for(int I=1;I

{

EXAMEN=float.Parse(CA.Text);
E1.INTRODUCECALIFICACION(EXAMEN);
listBox1.Items.Add(EXAMEN);

CA.Clear();
CA.Focus();


}



}

private void button2_Click(object sender, EventArgs e)
{

listBox1.Items.Add("No. Control: " + E1.MOSTRARIDE());
MessageBox.Show("Numero de control : " + E1.MOSTRARIDE() + "\n" + "Promedio : " + E1.PROMEDIO());



}

private void button3_Click(object sender, EventArgs e)
{
CO.Clear();
MA.Clear();
CA.Clear();
listBox1.Items.Clear();
}

private void button4_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}

Practica 13.1 Consola


PSEUDOCODIGO:

double ancho, largo;
public rectangulo()
{
ancho = 0;
largo = 0;

}
public void Asignardatos(float w,float h)
{
ancho=w;
largo=h;

}
public void Asignarancho(float w)
{ancho=w;

}
public void Asignarlargo(float h)
{
largo=h;
}
public double Obtenerancho()
{
return ancho;

}
public double Obtenerlargo()
{
return largo;
}
public double Area()
{
return largo*ancho;
}
public double Perimetro()
{
return 2*(largo+ancho);

}



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

namespace ConsoleApplication3
{
class rectangulo
{
double ancho;
double largo;



public rectangulo()
{
ancho = 0.0;
largo = 0.0;
}

public rectangulo(double w, double h)
{
ancho = w;
largo = h;
}
public double area()
{
return ancho * largo;
}
public double perimetro()
{
return 2 * (largo + ancho);
}
public void agsinarlargo(double h)
{
largo = h;
}
public void agsinarancho(double w)
{
ancho = w;
}
public double obtenerlargo()
{
return largo;
}
public double obtenerancho()
{
return ancho;
}
}
}


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

namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
double L, A;
rectangulo r1 = new
rectangulo();
Console.WriteLine("\n\t\t\tAREA Y PERIMETRO DE UN RECTANGULO");



Console.WriteLine("\nIntroduce el Largo de un rectangulo");
L = double.Parse(Console.ReadLine());
Console.WriteLine("\nIntroduce el ancho de un rectangulo");
A = double.Parse(Console.ReadLine());
r1.agsinarancho(A);
r1.agsinarlargo(L);

Console.WriteLine("\nArea= {0} ", r1.area());
Console.WriteLine("Perimetro= {0} ", r1.perimetro());
Console.ReadLine();
}
}
}

martes, 15 de diciembre de 2009

Practica 13.1 Visual


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

namespace Practica_13_V
{
class rectangulo
{
double ancho;
double largo;



public rectangulo()
{
ancho = 0.0;
largo = 0.0;
}

public rectangulo(double w, double h)
{
ancho = w;
largo = h;
}
public double area()
{
return ancho * largo;
}
public double perimetro()
{
return 2 * (largo + ancho);
}
public void agsinarlargo(double h)
{
largo = h;
}
public void agsinarancho(double w)
{
ancho = w;
}
public double obtenerlargo()
{
return largo;
}
public double obtenerancho()
{
return ancho;
}
}
}




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 Practica_13_V
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double L, A;
rectangulo r1 = new
rectangulo();
L = double.Parse(LAR.Text);
A = double.Parse(ANCH.Text);
r1.agsinarancho(A);
r1.agsinarlargo(L);

MessageBox.Show("El perimetro es : "+r1.perimetro()+"\n"+"El area es : "+ r1.area());
}

private void button2_Click(object sender, EventArgs e)
{
ANCH.Clear();
LAR.Clear();
}

private void button3_Click(object sender, EventArgs e)
{
Application.Exit();
}

private void Form1_Activated(object sender, EventArgs e)
{
LAR.Focus();
}

private void LAR_TextChanged(object sender, EventArgs e)
{

}
}
}

Practica 13.2 Consola


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

namespace ConsoleApplication1
{
class Class_estudiante
{
int IDE;
float [] calif;
int total;
public Class_estudiante ()
{
IDE=0;
calif=new float[5];
total=0;
}
public void introduceIDE(int NC)
{
IDE=NC;
}
public void introducecalif(float Nota)
{
calif[total]=Nota;
total++;
}
public float promedio()
{
float suma=0.0f;
int I;
for (I=0; I
{
suma=suma+calif[I];
}
return suma/total;
}
public int mostrarIDE()
{
return IDE;
}
}
}



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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int C = 0, bandera = 0, Nocontrol;
float examen;
Class_estudiante E1 = new Class_estudiante();
do
{
Console.WriteLine("introduce identificacion de estudiante:");
Nocontrol=int.Parse(Console.ReadLine());
E1.introduceIDE (Nocontrol);
Console.WriteLine("introduce la cantidad de calificaciones (<5):");
C=int.Parse(Console.ReadLine());
for (int I=0; I
{
Console.WriteLine("introduce calificaciones {0} examen:", I+1);
examen=float.Parse(Console.ReadLine());
E1.introducecalif(examen);
}

Console.WriteLine("identificacion alumno={0}",E1.mostrarIDE());
Console.WriteLine("promedio={0}",E1.promedio());
Console.WriteLine("presione 1 para registrar otro estidiante y 0 para salir ");
bandera=int.Parse(Console.ReadLine());
}
while(bandera==1);
Console.ReadLine();
}

lunes, 14 de diciembre de 2009

Practica 12.2 Visual


PSEUDOCODIGO


int N1, N2;
int suma()
{
return N1 + N2;
}
int multiplica()
{
return N1 * N2;
}

{
READ N1
READ N2
int R1 = suma();
int R2 = multiplica();
PRINT "Suma:" + R1
PRINT "Multiplicacion:" + R2

}



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 DATOS_W
{
public partial class Form1 : Form
{
int N1, N2;
int suma()
{
return N1 + N2;
}
int multiplica()
{
return N1 * N2;
}


public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
N1 = int.Parse(D1.Text);
N2 = int.Parse(D2.Text);
int R1 = suma();
int R2 = multiplica();
listBox1.Items.Add("Suma:" + R1);
listBox1.Items.Add("Multiplicacion:" + R2);

}

private void button2_Click(object sender, EventArgs e)
{
D1.Clear();
D2.Clear();
listBox1.Items.Clear();
}

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

Practica 12.1 Consola


PSEUDOCODIGO

static void ImpriMemensaje (string Dato)

{
PRINT (Dato);
}
static void Main ()
{
string mensaje;
PRINT "Introduce mensaje para navidad"
READ mensaje
ImpriMemensaje (mensaje);
ImpriMemensaje (mensaje);
ImpriMemensaje(mensaje);
FINAL





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

namespace METODO_C
{
class Program
{
static void ImpriMemensaje (string Dato)

{
Console.WriteLine(Dato);
}
static void Main ()
{
string mensaje;
Console.WriteLine("Introduce mensaje para navidad");
mensaje = Console.ReadLine();
ImpriMemensaje (mensaje);
ImpriMemensaje (mensaje);
ImpriMemensaje(mensaje);
Console.ReadKey();


}
}
}

Practica 11.4 Consola


Pseudocodigo

int suma = 0, mayor = 0, np = 0, diap = 0;
int r, c;
string plantas[12];
int[,] produccion[13, 8];
for (r = 0; r < suma="0;" c =" 0;" suma =" suma" c =" 0;" suma =" 0;" r =" 0;" suma =" suma" r =" 0;"> mayor)
{
mayor = produccion[r, 7];
np = r + 1;
}
}
Print "Plantas mas productivas ", np + 1
Print "Produccion de la pantal mas productiva ", produccion[np, 7]
mayor = 0;
for (c = 0; c <> mayor)
{
mayor = produccion[12, c];
diap = c + 1;
}
}
Print "Dia con mayor produccion:"
switch(diap)
{
case 1: print "Lunes"
break;
case 2: print "Martes"
break;
case 3: print "Miercoles"
break;
case 4: print "Jueves"

break;
case 5: print "Viernes"
break;
case 6: print "Sabado"
break;
case 7: print "Domingo"
break;
}
Prin t"Mayor Produccion en un dia", mayor
FIN

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

namespace PRACTICA_11_4_C
{
class Program
{
static void Main(string[] args)
{
int suma = 0, mayor = 0, np = 0, diap = 0;
int r, c;
string[] plantas = new string[12];
int[,] produccion = new int[13, 8];
for (r = 0; r < suma="0;" c =" 0;" suma =" suma" c =" 0;" suma =" 0;" r =" 0;" suma =" suma" r =" 0;"> mayor)
{
mayor = produccion[r, 7];
np = r + 1;
}
}
Console.WriteLine("Plantas mas productivas {0}", np + 1);
Console.WriteLine("Produccion de la pantal mas productiva {0}", produccion[np, 7]);
mayor = 0;
for (c = 0; c <> mayor)
{
mayor = produccion[12, c];
diap = c + 1;
}
}
Console.WriteLine("Dia con mayor produccion:");
switch(diap)
{
case 1: Console.WriteLine("Lunes");
break;
case 2: Console.WriteLine("Martes");
break;
case 3: Console.WriteLine("Miercoles");
break;
case 4: Console.WriteLine("Jueves");

break;
case 5: Console.WriteLine("Viernes");
break;
case 6: Console.WriteLine("Sabado");
break;
case 7: Console.WriteLine("Domingo");
break;
}
Console.WriteLine("Mayor Produccion en un dia {0}", mayor);
Console.ReadKey();





}
}
}

Practica 11.3 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 Accidentes_W
{
public partial class Form1 : Form
{
ArregloBidimencional Reticula = new ArregloBidimencional(10, 29);
int avenida, calle, numacc, I = 0, J = 0;
int mayor1, indice1R = 0, indice1C = 0;
int mayor2, indice2R = 0, indice2C = 0;
int mayor3, indice3R = 0, indice3C = 0;
String salida = "";
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{

avenida = int.Parse(textBox1.Text);
textBox1.Clear();
calle = int.Parse(textBox2.Text);
textBox2.Clear();
numacc = int.Parse(textBox3.Text);
textBox3.Clear();
Reticula.numeroaccidentes(avenida - 1, calle - 30, numacc);
}

private void button2_Click(object sender, EventArgs e)
{
for (I = 0; I < salida = "" j =" 0;" mayor1 =" Reticula.DatoMayor(10," indice1r =" Reticula.indRenglon;" indice1c =" Reticula.indColumna;" mayor2 =" Reticula.DatoMayor(10," indice2r =" Reticula.indRenglon;" indice2c =" Reticula.indColumna;" mayor3 =" Reticula.DatoMayor(10," indice3r =" Reticula.indRenglon;" indice3c =" Reticula.indColumna;">

Practica 11.3 Consola




PSEUDOCODIGO


int ciudad [10, 29]
int ave, calle, AC, a, c, suige, posave=0, poscalle=0;
int mayor = 0;
do
{
do
{
PRINT "Introduce No. de Avenida"
READ ave
if(ave<1>10)
{
PRINT "ERRORO AL INTRODUCIR AVENIDA"
}
}

while(ave<1>10);
do
{
PRINT "Introduce No de Calle"
READ calle
if(calle<30>58)
{
PRINT "ERRORO AL INTRODUCIR LA CALLE"
}
}

while(calle<30>58);
PRINT "Introduce Numero de Accidentes"
READ AC
ciudad[ave-1,calle-30]=AC;
PRINT "Precione 1 Para Continuar O Cero Para Entrada de Datos"
READ suige
}
while(suige==1);
for (a = 0; a <= 9; a++) { for (c = 0; c <= 28; c++) { if (ciudad[a, c] > mayor)
{
mayor = ciudad[a, c];
posave = a;
poscalle = c;
}
}
}

PRINT "la primera interseccion mas peligrosas estaentre la avenida:
PRINT “la calle:”
PRINT “con numero de accindetes”
ciudad[posave,poscalle]=0;
mayor=0;

fin


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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[,] ciudad = new int[10, 29];
int ave, calle, AC, a, c, suige, posave=0, poscalle=0;
int mayor = 0;
do
{
do
{
Console.WriteLine("Introduce No. de Avenida");
ave=int.Parse(Console.ReadLine());
if(ave<1>10)
{
Console.WriteLine("ERRORO AL INTRODUCIR AVENIDA");
}
}

while(ave<1>10);
do
{
Console.WriteLine("Introduce No de Calle");
calle=int.Parse(Console.ReadLine());
if(calle<30>58)
{
Console.WriteLine("ERRORO AL INTRODUCIR LA CALLE");
}
}

while(calle<30>58);
Console.WriteLine("Introduce Numero de Accidentes");
AC=int.Parse(Console.ReadLine());
ciudad[ave-1,calle-30]=AC;
Console.WriteLine("Precione 1 Para Continuar O Cero Para Entrada de Datos");
suige=int.Parse(Console.ReadLine());
}
while(suige==1);
for (a = 0; a <= 9; a++) { for (c = 0; c <= 28; c++) { if (ciudad[a, c] > mayor)
{
mayor = ciudad[a, c];
posave = a;
poscalle = c;
}
}
}
Console.WriteLine("la primera interseccion mas peligrosas estaentre la avenida: {0}\ty la la calle {1} \tcon numero de accindetes {2}",posave,poscalle,mayor);
ciudad[posave,poscalle]=0;
mayor=0;
Console.ReadKey();
}
}
}

miércoles, 9 de diciembre de 2009

Practica 11.3 Consola

PSEUDOCODIGO


int ciudad [10, 29]
int ave, calle, AC, a, c, suige, posave=0, poscalle=0;
int mayor = 0;
do
{
do
{
PRINT "Introduce No. de Avenida"
READ ave
if(ave<1>10)
{
PRINT "ERRORO AL INTRODUCIR AVENIDA"
}
}

while(ave<1>10);
do
{
PRINT "Introduce No de Calle"
READ calle
if(calle<30>58)
{
PRINT "ERRORO AL INTRODUCIR LA CALLE"
}
}

while(calle<30>58);
PRINT "Introduce Numero de Accidentes"
READ AC
ciudad[ave-1,calle-30]=AC;
PRINT "Precione 1 Para Continuar O Cero Para Entrada de Datos"
READ suige
}
while(suige==1);
for (a = 0; a <= 9; a++)
{
for (c = 0; c <= 28; c++)
{
if (ciudad[a, c] > mayor)
{
mayor = ciudad[a, c];
posave = a;
poscalle = c;
}
}
}

PRINT "la primera interseccion mas peligrosas estaentre la avenida:
PRINT “la calle:”
PRINT “con numero de accindetes”
ciudad[posave,poscalle]=0;
mayor=0;

fin




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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[,] ciudad = new int[10, 29];
int ave, calle, AC, a, c, suige, posave=0, poscalle=0;
int mayor = 0;
do
{
do
{
Console.WriteLine("Introduce No. de Avenida");
ave=int.Parse(Console.ReadLine());
if(ave<1>10)
{
Console.WriteLine("ERRORO AL INTRODUCIR AVENIDA");
}
}

while(ave<1>10);
do
{
Console.WriteLine("Introduce No de Calle");
calle=int.Parse(Console.ReadLine());
if(calle<30>58)
{
Console.WriteLine("ERRORO AL INTRODUCIR LA CALLE");
}
}

while(calle<30>58);
Console.WriteLine("Introduce Numero de Accidentes");
AC=int.Parse(Console.ReadLine());
ciudad[ave-1,calle-30]=AC;
Console.WriteLine("Precione 1 Para Continuar O Cero Para Entrada de Datos");
suige=int.Parse(Console.ReadLine());
}
while(suige==1);
for (a = 0; a <= 9; a++)
{
for (c = 0; c <= 28; c++)
{
if[p11.3.jpg] (ciudad[a, c] > mayor)
{
mayor = ciudad[a, c];
posave = a;
poscalle = c;
}
}
}
Console.WriteLine("la primera interseccion mas peligrosas estaentre la avenida: {0}\ty la la calle {1} \tcon numero de accindetes {2}",posave,poscalle,mayor);
ciudad[posave,poscalle]=0;
mayor=0;
Console.ReadKey();
}
}
}

Practica 11.2 Visual

[11.2.jpg]
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 Vendedores_W
{
public partial class Form1 : Form
{
double[,] sueldos = new double[10, 20];
double[] Precio = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 };
int NV, ART, N;

public Form1()
{
InitializeComponent();
listBox1.Items.Add("Vendedor Articulo Cantidad");
listBox2.Items.Add("Vendedor Sueldo");

NV = ART = N = 0;
}

private void button1_Click(object sender, EventArgs e)
{




NV = int.Parse(VTXT.Text);
VTXT.Clear();
ART = int.Parse(A.Text);
A.Clear();
N = int.Parse(C.Text);
C.Clear();

listBox1.Items.Add(NV.ToString() + "\t\t" + ART.ToString() + "\t" + N.ToString());
sueldos[NV - 1, ART - 1] = sueldos[NV - 1, ART - 1] + N * Precio[ART - 1];







}

private void button2_Click(object sender, EventArgs e)
{
int V, P;
double SUM, salario;
for (V=0;V<10;v=v+1) sum =" 0;" p="0;P<20;P="P+1)" sum =" SUM" salario =" SUM">

Practica 11.2 Consola

[p11.2.jpg]
PSEUDOCODIGO

doublE sueldos[10, 20]
double[] precio = { 2.50, 3.90, 5.78, 23.45, 34.56, 13.24, 12.30, 23.43, 34.56, 34.67, 34.67, 34.23, 45.56, 32.34, 34.34, 34.45, 67.56, 45.67, 45.34, 45.45 };
int Nv, Art, N, sigue = 1;

do
{
print "Numero de vendedor:"

read Nv

print "Numero de articulo:"

read Art

print "Cantidad de articulo:"

read N

sueldos[Nv - 1, Art - 1] = sueldos[Nv - 1, Art - 1] + N * precio[Art - 1];

print "Presione 1 para continuar o 0 para calcular sueldos"
read sigue
}
while (sigue == 1);
{
int v, p;
double sum, salario;
for (v = 0; v < v =" v" sum =" 0;" p =" 0;" p =" p" sum =" sum" salario =" sum">


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

namespace PRACTICA_11_VENDEDORES_C
{
class Program
{
static void Main(string[] args)
{
double[,] sueldos = new double[10, 20];
double[] precio = { 2.50, 3.90, 5.78, 23.45, 34.56, 13.24, 12.30, 23.43, 34.56, 34.67, 34.67, 34.23, 45.56, 32.34, 34.34, 34.45, 67.56, 45.67, 45.34, 45.45 };
int Nv, Art, N, sigue = 1;

do
{
Console.WriteLine("Numero de vendedor:");

Nv = int.Parse(Console.ReadLine());

Console.WriteLine("Numero de articulo:");

Art = int.Parse(Console.ReadLine());

Console.WriteLine("Cantidad de articulo:");

N = int.Parse(Console.ReadLine());

sueldos[Nv - 1, Art - 1] = sueldos[Nv - 1, Art - 1] + N * precio[Art - 1];

Console.WriteLine("Presione 1 para continuar o 0 para calcular sueldos");
sigue = int.Parse(Console.ReadLine());

}
while (sigue == 1);
{
int v, p;
double sum, salario;
for (v = 0; v < v =" v" sum =" 0;" p =" 0;" p =" p" sum =" sum" salario =" sum">

Practica 11.1 Visual

[11_1.jpg]

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 Valor_Maximo_W
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
int[,] num = { { 16, 22, 99, 4, 18 }, { -258, 4, 101, 5, 98 }, { 105, 6, 15, 2, 45 }, { 33, 88, 72, 16, 3 } };
int Mayor = num[0, 0];
int posR = 0, posC = 0, R, C;

for (R = 0; R < 4; R++)
{
for (C = 0; C < 5; C++)
{
if (num[R, C] > Mayor)
{
posR = R;
posC = C;
Mayor = num[R, C];
}
}
}
for (R = 0; R < 4; R++)
{
for (C = 0; C < 5; C++)
{
listBox1.Items.Add(num[R, C]);

}

}
MessageBox.Show("\nEl dato mayor es: " + Mayor +"\n"+ "En el renglon: " + posR + 1 +"\n"+ "Y la columna: " + posC + 1);
}

private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}

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

Practica 11.1 Consola

PSEUDOCODIGO

int[,] num = {{ 16, 22, 99, 4, 18 },{ -258, 4, 101, 5, 98 },{ 105, 6, 15, 2, 45 },{ 33, 88, 72, 16, 3 }};
int Mayor = num[0, 0];
int posR = 0, posC = 0, R, C;
for (R = 0; R <4; R++)
{
for (C = 0; C <5 ; C++)
{
if (num[R, C] > Mayor)
{
posR = R;
posC = C;
Mayor = num[R, C];
}
}
}
for (R = 0; R < 4; R++)
{
for (C = 0; C < 5; C++)
{
print num[R, C]);
}
print Mayor
print posR+1
print posC+1

FIN




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

namespace PRACTICA_11_1C
{
class Program
{
static void Main(string[] args)
{
int[,] num = {{ 16, 22, 99, 4, 18 },{ -258, 4, 101, 5, 98 },{ 105, 6, 15, 2, 45 },{ 33, 88, 72, 16, 3 }};
int Mayor = num[0, 0];
int posR = 0, posC = 0, R, C;
for (R = 0; R <4; R++)
{
for (C = 0; C <5 ; C++)
{
if (num[R, C] > Mayor)
{
posR = R;
posC = C;
Mayor = num[R, C];
}
}
}
for (R = 0; R < 4; R++)
{
for (C = 0; C < 5; C++)
{
Console.Write("\t{0}", num[R, C]);
}
Console.WriteLine();
}
Console.WriteLine("El dato mayor es: {0}", Mayor);
Console.WriteLine("En el renglon: {0}", posR+1);
Console.WriteLine("Y la columna: {0}", posC+1);

Console.ReadKey();


}
}
}
[p11.1.jpg]

martes, 17 de noviembre de 2009

Practica extra problema 3 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 examen_2__Windows
{
public partial class Form1 : Form
{
double lim, peso, sum;
public Form1()
{
InitializeComponent();
sum = 0;
}

private void button1_Click(object sender, EventArgs e)
{
lim = double.Parse(textBox1.Text);
listBox1.Items.Add("\tPESO INDIVIDUAL");
textBox1.Enabled = false;
button1.Enabled = false;
textBox2.Focus();

}

private void button2_Click(object sender, EventArgs e)
{
peso = double.Parse(textBox2.Text);
if (sum <>
{
sum = sum + peso;
listBox1.Items.Add("\t\t" + peso.ToString());
if (sum > lim)
{
listBox1.Items.Add("Ha exedido el limite");
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 button3_Click(object sender, EventArgs e)
{
Close();
}

private void button4_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}
}
}

Practica extra problema 3 Consola


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

namespace Pesca_Consola
{
class Program
{
static void Main(string[] args)
{
int limite, peso, suma = 0;
Console.WriteLine("Introduce limite de pesca:");
limite = int.Parse(Console.ReadLine());
do
{
Console.WriteLine("\nIntroduce peso individual pescado:");
peso = int.Parse(Console.ReadLine());
suma = suma + peso;
if (suma > limite)
Console.WriteLine("Ha excedido el limite");
Console.WriteLine("Total= " + suma);
}
while (suma <>

Console.ReadKey();
}
}
}

Practica extra problema 2 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 Num_rom_Visual
{
public partial class Form1 : Form
{
int numero;
public Form1()
{
InitializeComponent();
numero = 0;
}

private void button1_Click(object sender, EventArgs e)
{
numero = int.Parse(textBox1.Text);
textBox1.Clear();
textBox1.Focus();
if (numero <= 10 && numero > -1)
switch (numero)
{
case 1: listBox1.Items.Add(numero + "=Su equivalente en numero romano es I");
break;
case 2: listBox1.Items.Add(numero + "=Su equivalente en numero romano es II");
break;
case 3: listBox1.Items.Add(numero + "=Su equivalente en numero romano es III");
break;
case 4: listBox1.Items.Add(numero + "=Su equivalente en numero romano es IV");
break;
case 5: listBox1.Items.Add(numero + "=Su equivalente en numero romano es V");
break;
case 6: listBox1.Items.Add(numero + "=Su equivalente en numero romano es VI");
break;
case 7: listBox1.Items.Add(numero + "=Su equivalente en numero romano es VII");
break;
case 8: listBox1.Items.Add(numero + "=Su equivalente en numero romano es VIII");
break;
case 9: listBox1.Items.Add(numero + "=Su equivalente en numero romano es IX");
break;
case 10: listBox1.Items.Add(numero + "=Su equivalente en numero romano es X");
break;
case 0: listBox1.Items.Add(numero + "=Salida programa");
textBox1.Clear();
textBox1.Enabled = false;
button1.Enabled = false;
break;
}
else
{
listBox1.Items.Add(numero + "=No introdujo numero correcto");
}
}

private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}

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

Practica extra problema 2 consola


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

namespace Practica_ext_Num.rom
{
class Program
{
static void Main(string[] args)
{
int numero;
do
{
Console.WriteLine("Introduce un valor entero 1-10 y 0 para salir");
numero = int.Parse(Console.ReadLine());
switch (numero)
{
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;
case 0: Console.WriteLine("Salida Programa");
break;
default: Console.WriteLine("No Introducio numero correcto");
break;
}
}
while (numero != 0);
Console.ReadKey();
}
}
}

Practica extra problema 1 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 practica_extra_suma_de_nuemeros_visual
{
public partial class Form1 : Form
{
int n, suma, promedio, dato;
public Form1()
{
InitializeComponent();
n = suma = promedio = 0;
dato = 0;
label1.Text= "introduceun numero entero".ToString();
}

private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Add("numero entero");
n = int.Parse(textBox1.Text);
listBox1.Items.Add(n.ToString());
if (n != 9999)
{
suma = suma + n;
textBox1.Clear();
textBox1.Focus();
dato++;
if (n == 9999)
{
textBox1.Clear();
textBox1.Enabled = false;
button1.Enabled = false;
}



}
else
{
textBox1.Clear();
textBox1.Enabled = false;
button1.Enabled = false;
if (n == 0)
{
label1.Text = "introduceun numero diferente a 0".ToString();
}

}
}

private void button2_Click(object sender, EventArgs e)
{
promedio = suma / dato;
listBox1.Items.Add("el promedio es "+promedio.ToString());

}

private void button3_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
textBox1.Enabled = true;
button1.Enabled = true;
}

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

Practica extra problema 1 consola







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

namespace practica_extra_sumade_numeros_enteros
{
class Program
{
static void Main(string[] args)
{
int n = 0, suma = 0, promedio = 0;
int dato = 0;
Console.WriteLine("introduce nuemero entero ");
n = int.Parse(Console.ReadLine());
while (n != 9999)
{
suma = suma + n;
dato = dato + 1;
if (n == 0)
{
Console.WriteLine("introduce numero diferente a 0");
n = int.Parse(Console.ReadLine());
suma = suma + n;
dato = dato - 1;
}
Console.WriteLine("introduce nuemero entero ");
n = int.Parse(Console.ReadLine());
}

if (n == 9999)
{
dato = dato - 1;
}
promedio = suma / dato;
Console.WriteLine("el promedio es {0}", promedio);
Console.ReadKey();
}
}
}

jueves, 12 de noviembre de 2009

Practica 7.8 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 Practica_8_prob_8_W
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
int N, P = 1, C;
N = int.Parse(textBox1.Text);
label2.Text = "El producto de los numeros es:";
for (C = 1; C <= N; C = C + 2)
{
P = P * C;
}
label2.Text = label2.Text + P.ToString();


}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = ("");
}

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

Practica 7.7 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 Practica_8_prob_8_W
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button2_Click(object sender, EventArgs e)
{
int N, P = 1, C;
N = int.Parse(textBox1.Text);
label2.Text = "El producto de los numeros es:";
for (C = 1; C <= N; C = C + 2)
{
P = P * C;
}
label2.Text = label2.Text + P.ToString();


}

private void button3_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = ("");
}

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

Practica 7.6 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 Mayor_o_Men_W
{
public partial class Form1 : Form
{
int N, Valor, May, Men, c = 1;
public Form1()
{
InitializeComponent();

listBox1.Items.Add("Valores enteros");
}

private void textBox2_TextChanged(object sender, EventArgs e)
{

}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
N = int.Parse(textBox1.Text);
Valor = int.Parse(textBox2.Text);
textBox2.Focus();
textBox2.Clear();

if (c <= N)
{


listBox1.Items.Add(Valor);

if (Valor > May)
{
May = Valor;
}
if (Valor <>
{
Men = Valor;
}

c = c + 1;
}

else
{
textBox2.Clear();
textBox2.Enabled = false;
button1.Enabled = false;
}





}

private void button2_Click(object sender, EventArgs e)
{
label3.Text = "El dato mayor es:" + May.ToString();
label4.Text = "El dato menor es:" + Men.ToString();
}

private void button3_Click(object sender, EventArgs e)
{
textBox2.Clear();
textBox1.Clear();
listBox1.Items.Clear();
button1.Enabled = true;
}

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

Practica 7.4 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 Practica_8_prob_4_W
{
public partial class Form1 : Form
{
int N;
int valores;
int I = 0;
int sumapar = 0;
int sumaimpar = 0;

public Form1()
{



InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
N = int.Parse(textBox1.Text);

if (I <= N) { I = int.Parse(textBox2.Text); listBox1.Items.Add(I); if (I % 2 == 0) { sumapar += I; } if (I % 2 == 1) { sumaimpar += I; } I++; } else { button1.Enabled = false; } textBox1.Focus(); textBox2.Focus(); textBox2.Clear(); } private void button2_Click(object sender, EventArgs e) { if (sumapar > sumaimpar)
{
label5.Text = "La suma mayor es par";
}
else
{
label5.Text = "La suma mayor es impar";
}


label3.Text = "La suma de los pares es:" + sumapar.ToString();
label4.Text = "La suma de los impares es:" + sumaimpar.ToString();


}

private void button3_Click(object sender, EventArgs e)
{
label3.Text = "";
label4.Text = "";
label5.Text = "";
listBox1.Items.Clear();
textBox1.Clear();
textBox2.Clear();
button1.Enabled = true;

}

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

}
}

Practica 10.1 Visual



using System.Windows.Forms;
using System;
namespace Practica_10._1_Visual
{
public partial class Form1 : Form
{
double[] pendiente;
double minimo, maximo;
int i;
public Form1()
{
InitializeComponent();
pendiente = new double[] { 17.24, 25.63, 5.94, 33.92, 3.71, 32.84, 35.93, 18.24, 6.92 };
maximo = pendiente[0];
minimo = pendiente[0];
}

private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Add("\tPendientes");
for (i = 0; i <>
{
listBox1.Items.Add(pendiente[i].ToString());
if (pendiente[i] > maximo)
{
maximo = pendiente[i];
}
if (pendiente[i] <>
{
minimo = pendiente[i];
}
}
listBox1.Items.Add("El valor maximo es: " + maximo);
listBox1.Items.Add("El valor minimo es: " + minimo);
}

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

Practica 10.1 Consola


PSEUDOCODIGO
{INICIO
REAL pendiente[9] = { 17.24, 25.63, 5.94, 33.92, 3.71, 2.84, 35.93, 18.24, 6.92 };
double mayor = pendiente[0];
double menor = pendiente[0];
int i;
PRINT "Pendientes:"
for(i=0 TO 8 STEP I¿I+1 )
{
PRINT(pendiente[i]);
if(pendiente[i]>mayor)
{
mayor=pendiente[i];
}
if(pendiente[i]
{
menor=pendiente[i];
}}

PRINT "Dato Mayor: {0}",mayor
PRINT "Dato Me
nor: {0}", menor
FINAL













using System;
namespace Practica_10._1_Consola
{
class Program
{
static void Main(string[] args)
{
double[] pendiente = { 17.24, 25.63, 5.94, 33.92, 3.71, 32.84, 35.93, 18.24, 6.92 };
double minimo, maximo;
int i;
maximo = pendiente[0];
minimo = pendiente[0];
Console.WriteLine("Pendientes");
for (i = 0; i <> maximo)
{
maximo = pendiente[i];
}
if (pendiente[i] < minimo)
{
minimo = pendiente[i];
}
}

Console.WriteLine("\nEl valor maximo es: " + maximo);
Console.WriteLine("El valor minimo es: " + minimo);
Console.ReadKey();
}
}
}

Practica 10.2 Visual


PSEUDOCODIGO
REAL[] resistencia ={16,27,39,56,81};
REAL[] corriente = new int [5];
REAL[] potencia = new int[5];
REAL total = 0, I = 0;
for (I = 0 TO 4 STEP I=I+1)
{
PRINT("Introduce corriente",I);
READ corriente[I]
potencia[I] = resistencia[I] * (corriente[I] * corriente[I]);
total = total + potencia[I];

}

PRINT(" Resistencia Corriente Potencia");
PRINT("________________________________________________");

for (I = 0 TO 4 STEP I=I+1)
{
PRINT(" {0} {1} {2}", resistencia[I], corriente[I], potencia[I]);

}
PRINT("Total= " + total);
FINAL









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 PRACTICA_10_1_W
{
public partial class Form1 : Form
{
int[] RESISTENCIAS = { 16, 27, 39, 56, 81 };
int[] CORRIENTE = new int[5];
int[] POTENCIA = new int[5];
int TOTAL = 0;
int I;

public Form1()
{
InitializeComponent();
listBox1.Items.Add("Resistencia Corriente Potencia");
listBox1.Items.Add("_____________________________________________");

}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show("El total es:" + TOTAL);

{



}
}

private void button1_Click(object sender, EventArgs e)
{
if (I <>
{
textBox1.Focus();
CORRIENTE[I] = int.Parse(textBox1.Text);
POTENCIA[I] = CORRIENTE[I] * RESISTENCIAS[I];
textBox1.Clear();
POTENCIA[I] = RESISTENCIAS[I] * CORRIENTE[I] * CORRIENTE[I];
TOTAL = TOTAL + POTENCIA[I];
listBox1.Items.Add(RESISTENCIAS[I] + "\t\t" + CORRIENTE[I] + "\t\t" + POTENCIA[I]);
I++;
}

}

private void button3_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
textBox1.Clear();

}

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

Practica 10.2 Consola



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

namespace PRACTICA_10_1C
{
class Program
{
static void Main(string[] args)
{
int[] RESISTENCIAS = { 16, 27, 39, 56, 81 };
int[] CORRIENTE = new int[5];
int[] POTENCIA = new int[5];
int TOTAL = 0;
int I;
for (I = 0; I <= 4; I = I + 1)
{
Console.WriteLine("Introduce corriente:", I + 1);
CORRIENTE[I] = int.Parse(Console.ReadLine());
POTENCIA[I] = RESISTENCIAS[I] * CORRIENTE[I] * CORRIENTE[I];
TOTAL = TOTAL + POTENCIA[I];

}
Console.WriteLine("RESISTENCIA CORRIENTE POTENCIA");
Console.WriteLine("_________________________________________________");
for (I = 0; I <= 4; I = I + 1)
{
Console.WriteLine("{0}\t\t\t{1}\t\t{2}", RESISTENCIAS[I], CORRIENTE[I], POTENCIA[I]);
}
Console.WriteLine("\n\nEl total es:{0}", TOTAL);
Console.ReadKey();
}
}
}

Practica 10.3 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 PRACTICA_10_3_W
{
public partial class Form1 : Form
{
double[,] voltajes = new double[3, 6];
int C1, C2;
int R, C;

public Form1()
{
InitializeComponent();
C1 = C2 = 0;
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
if (R < 3)
{
if (C < 5)
{
voltajes[R, C] = double.Parse(V.Text);
listBox1.Items.Add("Voltaje[" + R.ToString() + "," + C.ToString() + "]:" + voltajes[R, C].ToString());
C++;
V.Clear();
V.Focus();
}
else
{
R++;
C = 0;
}
}


}

private void button2_Click(object sender, EventArgs e)
{
for (R = 0; R < 3; R++)
{
for (C = 0; C < 5; C++)
{
if (voltajes[R, C] < 60)
{
C1 = C1 + 1;
}
else
{
if (voltajes[R, C] >= 60)
{
C2 = C2 + 1;
}
}
}
}
MessageBox.Show("Voltajes <>= 60 : " + C2);
}

private void button3_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
V.Clear();

}

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

}
}