using System;
using System.Collections.Generic;
using System.Text;
class Estudiante
{
public int identificador;
float[] calificaciones;
int total;
public Estudiante()
{
total = 0;
calificaciones = new float[5];
identificador = 0;
}
public void noidentificacion()
{
Console.WriteLine("introduce el numero de identificacion");
identificador = Convert.ToInt16(Console.ReadLine());
}
public void calificacion()
{
for (int i = 0; i < 5; i++)
{
Console.WriteLine("introduce la Calificacion {0}:", i+1);
calificaciones[i] = Convert.ToSingle(Console.ReadLine());
total=total+(int)calificaciones[i];
}
}
public void Promedio()
{
double prom;
prom=(double)total/5;
Console.WriteLine("el promedio es: {0}", prom);
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace examen_2
{
class Program
{
static void Main(string[] args)
{
Estudiante est = new Estudiante();
est.noidentificacion();
est.calificacion();
est.Promedio();
Console.ReadLine();
}
}
}
Friday, November 21, 2008
Friday, October 31, 2008
EXAMEN CONSOLA, VISUAL Y DIAGRAMA

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class frmExamen : Form
{
int[,] Matriz;
string[] Nombres;
int R, C;
int M, N,renglon;
int mayor = 0;
public frmExamen()
{
InitializeComponent();
R = C = 0;
M = N = 0;
}
private void button1_Click(object sender, EventArgs e)
{
M = int.Parse(txtplantas.Text);
N = int.Parse(txtdias.Text);
Nombres = new string[M];
Matriz = new int[M, N + 1];
txtplantas.Enabled = false;
txtdias.Enabled = false;
button1.Enabled = false;
txtnplanta.Text = (R + 1).ToString();
textBox4.Text = (C + 1).ToString();
txtproduccion.Focus();
}
private void button2_Click(object sender, EventArgs e)
{
if (R < M && C < N)
{
Matriz[R, C] = int.Parse(txtproduccion.Text);
Nombres[R] = txtplantan.Text;
C++;
txtplantan.Enabled = false;
if (C == N)
{
C = 0;
R++;
txtplantan.Enabled = true;
txtplantan.Clear();
}
if (R != M)
{
txtnplanta.Text = (R + 1).ToString();
textBox4.Text = (C + 1).ToString();
txtproduccion.Clear();
txtproduccion.Focus();
}
else
{
txtnplanta.Enabled = false;
textBox4.Enabled = false;
txtproduccion.Enabled = false;
txtplantan.Enabled = false;
MessageBox.Show("Todos los datos fueron introducidos");
}
}
}
private void button3_Click(object sender, EventArgs e)
{
int Suma = 0;
lstagregar.Items.Add("No.Planta Planta Produccion semanal");
for (R = 0; R < M; R++)
{
Suma = 0;
for (C = 0; C < N; C++)
{
Suma += Matriz[R, C];
}
Matriz[R, C] = Suma;
}
for (R = 0; R < M; R++)
{
lstagregar.Items.Add((R + 1).ToString() + " " + Nombres[R] + " " + Matriz[R, N].ToString());
}
for (R = 0; R < M; R++)
{
Suma = Matriz[R, N];
if (Suma > mayor)
{
mayor = Matriz[R, N];
renglon = R;
}
}
lblNumplant.Text=" El numero de Planta con mayor produccion es:"+ (renglon + 1);
lblNombplant.Text="Nombre de la Planta:" + Nombres[renglon];
lblMayorprod.Text="Total de la produccion es:"+ mayor;
}
private void cmdSalida_Click(object sender, EventArgs e)
{
Close();
}
}
}
DIAGRAMA DE FLUJO DE EXAMEN


using System;
using System.Collections.Generic;
using System.Text;
namespace examen
{
class Program
{
static void Main(string[] args)
{
string[] nombres = new string[8];
int[,] produccion = new int[8, 7];
int suma=0;
int mayor = 0;
int mayor_planta=0;
Console.WriteLine("Examen");
for (int i = 0; i < 8; i++)
{
Console.Write("Captura nombre de la planta {0} ",i+1);
nombres[i] = Console.ReadLine();
}
for ( int j=0; j<8;j++){
Console.Clear();
Console.WriteLine("Planta {0}", nombres[j]);
for (int a = 0; a < 7; a++)
{
Console.Write("Captura la produccion dia {0} :", a + 1);
produccion[j, a] = System.Int32.Parse(Console.ReadLine());
}
Console.Clear();
}
//for (int i = 0; i < 8; i++)
//{
// Console.Write("{0}", nombres[i]);
//}
for (int j = 0; j < 8; j++)
{
suma = 0;
for (int a = 0; a < 7; a++)
{
Console.WriteLine("dia{0} produccion {1}", a + 1, produccion[j, a]);
suma = suma + produccion[j, a];
}
Console.WriteLine("\nProduccion total de planta {0} : {1} ", nombres[j], suma);
produccion[j,6]=suma;
}
Console.ReadLine();
Console.Clear();
mayor=0;
for (int j = 0; j < 8; j++)
{
if( produccion[j,6] < mayor){
mayor = produccion[j, 6];
mayor_planta=j;
}
}
Console.WriteLine("La planta con mayor produccion es {0}", nombres[mayor_planta]);
Console.ReadLine();
Console.WriteLine("Presione Intro para salir");
}
}
}
EXAMEN CONSOLA
using System;
using System.Collections.Generic;
using System.Text;
namespace examen
{
class Program
{
static void Main(string[] args)
{
string[] nombres = new string[8];
int[,] produccion = new int[8, 7];
int suma=0;
int mayor = 0;
int mayor_planta=0;
Console.WriteLine("Examen");
for (int i = 0; i < 8; i++)
{
Console.Write("Captura nombre de la planta {0} ",i+1);
nombres[i] = Console.ReadLine();
}
for ( int j=0; j<8;j++){
Console.Clear();
Console.WriteLine("Planta {0}", nombres[j]);
for (int a = 0; a < 7; a++)
{
Console.Write("Captura la produccion dia {0} :", a + 1);
produccion[j, a] = System.Int32.Parse(Console.ReadLine());
}
Console.Clear();
}
//for (int i = 0; i < 8; i++)
//{
// Console.Write("{0}", nombres[i]);
//}
for (int j = 0; j < 8; j++)
{
suma = 0;
for (int a = 0; a < 7; a++)
{
Console.WriteLine("dia{0} produccion {1}", a + 1, produccion[j, a]);
suma = suma + produccion[j, a];
}
Console.WriteLine("\nProduccion total de planta {0} : {1} ", nombres[j], suma);
produccion[j,6]=suma;
}
Console.ReadLine();
Console.Clear();
mayor=0;
for (int j = 0; j < 8; j++)
{
if( produccion[j,6] < mayor){
mayor = produccion[j, 6];
mayor_planta=j;
}
}
Console.WriteLine("La planta con mayor produccion es {0}", nombres[mayor_planta]);
Console.ReadLine();
Console.WriteLine("Presione Intro para salir");
}
}
}
using System.Collections.Generic;
using System.Text;
namespace examen
{
class Program
{
static void Main(string[] args)
{
string[] nombres = new string[8];
int[,] produccion = new int[8, 7];
int suma=0;
int mayor = 0;
int mayor_planta=0;
Console.WriteLine("Examen");
for (int i = 0; i < 8; i++)
{
Console.Write("Captura nombre de la planta {0} ",i+1);
nombres[i] = Console.ReadLine();
}
for ( int j=0; j<8;j++){
Console.Clear();
Console.WriteLine("Planta {0}", nombres[j]);
for (int a = 0; a < 7; a++)
{
Console.Write("Captura la produccion dia {0} :", a + 1);
produccion[j, a] = System.Int32.Parse(Console.ReadLine());
}
Console.Clear();
}
//for (int i = 0; i < 8; i++)
//{
// Console.Write("{0}", nombres[i]);
//}
for (int j = 0; j < 8; j++)
{
suma = 0;
for (int a = 0; a < 7; a++)
{
Console.WriteLine("dia{0} produccion {1}", a + 1, produccion[j, a]);
suma = suma + produccion[j, a];
}
Console.WriteLine("\nProduccion total de planta {0} : {1} ", nombres[j], suma);
produccion[j,6]=suma;
}
Console.ReadLine();
Console.Clear();
mayor=0;
for (int j = 0; j < 8; j++)
{
if( produccion[j,6] < mayor){
mayor = produccion[j, 6];
mayor_planta=j;
}
}
Console.WriteLine("La planta con mayor produccion es {0}", nombres[mayor_planta]);
Console.ReadLine();
Console.WriteLine("Presione Intro para salir");
}
}
}
Thursday, October 30, 2008
Practica 5 Visual

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Practica5_visual
{
public partial class frmPractica5visual : Form
{
public frmPractica5visual()
{
InitializeComponent();
}
int NumA = 0, NumC = 0, R = 0, C = 0;
int Suma = 0,b=0;
string[] Nombres;
int[,] Calificaciones;
double[] Promedio;
private void cmdCapturar_Click(object sender, EventArgs e)
{
if (R < NumA)
{
if (b == 0)
{
Nombres[R] = txtNombre.Text;
lstNombres.Items.Add(Nombres[R].ToString());
txtNombre.Enabled = false;
b = 1;
}
if (C < NumC)
{
txtCalificaciones.Enabled = true;
Calificaciones[R, C] = System.Int16.Parse(txtCalificaciones.Text);
txtNota.Text=txtNota.Text.ToString()+Calificaciones[R,C].ToString()+"\t";
txtCalificaciones.Clear();
txtCalificaciones.Focus();
C++;
if (C == NumC)
{
txtNota.Text = txtNota.Text + "\r\n";
txtNombre.Enabled = true;
txtNombre.Clear();
txtNombre.Focus();
R++;
b = 0;
C = 0;
}
}
}
if (R == NumA)
{
txtNombre.Enabled = false;
txtCalificaciones.Enabled = false;
for (R = 0; R < NumA; R++)
{
Suma = 0;
for (C = 0; C < NumC; C++)
{
Suma = Suma + Calificaciones[R, C];
}
Promedio[R] = Suma / NumC;
lstPromedio.Items.Add(Promedio[R].ToString());
}
}
}
private void cmdLimpiar_Click(object sender, EventArgs e)
{
txtCalificaciones.Clear();
txtNombre.Clear();
txtNumA.Enabled = true;
txtNumC.Enabled = true;
lstNombres.Items.Clear();
lstPromedio.Items.Clear();
txtNota.Clear();
txtNumA.Clear();
txtNumC.Clear();
txtNumA.Focus();
}
private void cmdCap_Click(object sender, EventArgs e)
{
NumA = System.Int16.Parse(txtNumA.Text);
NumC = System.Int16.Parse(txtNumC.Text);
txtNumA.Enabled = false;
txtNumC.Enabled = false;
Nombres = new string[NumA];
Calificaciones = new int[NumA, NumC];
Promedio = new double[NumA];
}
private void cmdSalida_Click(object sender, EventArgs e)
{
Close();
}
private void frmPractica5_Load(object sender, EventArgs e)
{
}
}
}
Practica 8 consola
using System;
using System.Collections.Generic;
using System.Text;
namespace Aplicacion_consola_tres_dimensionaes
{
class Program
{
static void Main(string[] args)
{
double[, ,] compañía;
int numS, noDep, dias;
Console.Write("Introduce el número de sucursales: ");
numS = int.Parse(Console.ReadLine());
Console.Write("Introduce el número de departamentos: ");
noDep = int.Parse(Console.ReadLine());
Console.Write("Introduce el número de dias : ");
dias = int.Parse(Console.ReadLine());
compañía = new double[numS, noDep, dias];
int p, s, t;
for (p = 0; p < numS; p++)
{
Console.WriteLine("Sucursal {0}: ", p + 1);
for (s = 0; s < noDep; s++)
{
Console.WriteLine("Departamento {0}: ", s + 1);
for (t = 0; t < dias; t++)
{
Console.Write(" dia {0}: ", t + 1);
compañía[p, s, t] = double.Parse(Console.ReadLine());
}
}
}
double suma = 0.0;
for (p = 0; p < numS; p++)
{
suma = 0.0;
for (s = 0; s < noDep; s++)
{
suma = 0.0;
for (t = 0; t < dias; t++)
{
suma += compañía[p, s, t];
}
Console.WriteLine("venta total por sucursal:{0}", suma);
}
Console.WriteLine(" No de Sucursal: {0} ", p + 1);
Console.WriteLine(" Venta Total es : {0} ", suma);
}
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Text;
namespace Aplicacion_consola_tres_dimensionaes
{
class Program
{
static void Main(string[] args)
{
double[, ,] compañía;
int numS, noDep, dias;
Console.Write("Introduce el número de sucursales: ");
numS = int.Parse(Console.ReadLine());
Console.Write("Introduce el número de departamentos: ");
noDep = int.Parse(Console.ReadLine());
Console.Write("Introduce el número de dias : ");
dias = int.Parse(Console.ReadLine());
compañía = new double[numS, noDep, dias];
int p, s, t;
for (p = 0; p < numS; p++)
{
Console.WriteLine("Sucursal {0}: ", p + 1);
for (s = 0; s < noDep; s++)
{
Console.WriteLine("Departamento {0}: ", s + 1);
for (t = 0; t < dias; t++)
{
Console.Write(" dia {0}: ", t + 1);
compañía[p, s, t] = double.Parse(Console.ReadLine());
}
}
}
double suma = 0.0;
for (p = 0; p < numS; p++)
{
suma = 0.0;
for (s = 0; s < noDep; s++)
{
suma = 0.0;
for (t = 0; t < dias; t++)
{
suma += compañía[p, s, t];
}
Console.WriteLine("venta total por sucursal:{0}", suma);
}
Console.WriteLine(" No de Sucursal: {0} ", p + 1);
Console.WriteLine(" Venta Total es : {0} ", suma);
}
Console.ReadLine();
}
}
}
Subscribe to:
Posts (Atom)

