Dia Mejor

Proyecto

Author: Moises
 
 

Practica 9.4

Author: Moises

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

namespace Problema4
{
class Program
{
static void Main(string[] args)
{
ArregloBidimensional Reticula = new ArregloBidimensional(10, 29);
int ave, calle, noac, cont;

do
{
Console.Clear();
Console.WriteLine("Registro de accidentes\n");
Console.Write("Avenida: ");
ave = int.Parse(Console.ReadLine());
Console.Write("Calle: ");
calle = int.Parse(Console.ReadLine());
Console.Write("# accidentes: ");
noac = int.Parse(Console.ReadLine());

Reticula.AsignarDato(ave - 1, calle - 30, noac);
Console.Write("Presione 1 para continuar");
cont = int.Parse(Console.ReadLine());
}
while (cont == 1);
Console.Clear();
double PrimerMayor = Reticula.DatoMayor(10, 29);
int PrimerIndiceR = Reticula.indRenglon;
int PrimerIndiceC = Reticula.indColumna;
Reticula.T1[PrimerIndiceR, PrimerIndiceC] = 0;
double SegundoMayor = Reticula.DatoMayor(10, 29);
int SegundoIndiceR = Reticula.indRenglon;
int SegundoIndiceC = Reticula.indColumna;
Reticula.T1[SegundoIndiceR, SegundoIndiceC] = 0;
double TercerMayor = Reticula.DatoMayor(10, 29);
int TercerIndiceR = Reticula.indRenglon;
int TercerIndiceC = Reticula.indColumna;


Console.WriteLine("No. Accidentes \tAvenida \tCalle");
Console.WriteLine("1. "+PrimerMayor + "\t\t" + PrimerIndiceR + "\t\t" + PrimerIndiceC);
Console.WriteLine("2. "+SegundoMayor + "\t\t" + SegundoIndiceR + "\t\t" + SegundoIndiceC);
Console.WriteLine("3. "+TercerMayor + "\t\t" + TercerIndiceR + "\t\t" + TercerIndiceC);

Console.ReadKey();
}
}
}

 

Practica 9.3

Author: Moises

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

namespace Problema3
{
class Program
{
static void Main(string[] args)
{
int M, N, R, C, Valor=0;
double suma;

Console.Write("Escribe el numero de renglones");
M = int.Parse(Console.ReadLine());
Console.Write("Escribe el numero de columnas");
N = int.Parse(Console.ReadLine());

ArBidim A = new ArBidim(M,N);

//faltan datos (falta arreglo?)
Arreglo X = new Arreglo(N);
Arreglo Y = new Arreglo(M);

for (R = 0; R < M; R++)
{
for (C = 0; C < N; C++)
{
Console.Write("Introduce Valor A[" + (R + 1) + "," + (C + 1)+"]: ");
Valor = int.Parse(Console.ReadLine());
A.T1[R, C] = Valor;

}
}

Console.WriteLine("Introduce los siguientes valores: ");

for (C = 0; C < N; C++)
{
Console.Write("X[" + (C + 1) + "]: ");
Valor = int.Parse(Console.ReadLine());
X.AsignarDato(C, Valor);
}


for (R = 0; R < M; R++)
{
suma = 0;

for (C = 0; C < N; C++)
{
suma = suma + A.T1[R, C] * X.ObtenerDato(C);
}

Y.elementos[R] = suma;
}
Console.WriteLine("Matriz");
for (R = 0; R < M; R++)
{
for (C = 0; C < N; C++)
{

Console.Write("\t{0}",A.ObtenerDato(R, C));
}
Console.WriteLine();

}
Console.WriteLine("\n\n");

for (C = 0; C < N; C++)
{
Console.Write("X[" + (C + 1) + "] = ");
Console.WriteLine("\t{0}",X.ObtenerDato(C));
}
Console.WriteLine();
for (R = 0; R < M; R++)
{
Console.Write("Y[" + (R + 1) + "] = ");
Console.WriteLine("\t{0}",Y.ObtenerDato(R));
}
Console.ReadKey();


}
}
}

 

Practica 9.2

Author: Moises

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 A_Bid_2_Visual
{
public partial class Form1 : Form
{
Arreglo Articulos = new Arreglo();
ArregloBidimensional ventas = new ArregloBidimensional(20, 50);
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
listBox1.Visible = false;
RbSi.Checked = true;
}

private void BtAceptar_Click(object sender, EventArgs e)
{


int Num, NoArt, Ven;

Num = int.Parse(textBox1.Text);
NoArt = int.Parse(textBox2.Text);
Ven = int.Parse(textBox3.Text);
ventas.T1[Num - 1, NoArt - 1] = Ven;


listBox1.Items.Clear();
listBox1.Items.Add("Calculo de sueldos");
listBox1.Items.Add("No Vendedor \tTotal Venta \tSueldo");

int R, C;
double suma, sueldo;
for (R = 0; R < 20; R++)
{
suma = 0.0;
for (C = 0; C < 50; C++)
{
suma = suma + ventas.ObtenerDato(R, C) * Articulos.ObtenerDato(C);
}
sueldo = suma * 0.05;

listBox1.Items.Add((R + 1) + "\t\t" + suma + "\t\t" + sueldo);

}


if (RbNo.Checked == true)
{
listBox1.Visible = true;
BtAceptar.Visible = false;
button1.Visible = false;
groupBox1.Visible = false;
groupBox2.Visible = false;
}
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
}

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

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

 

Practica 9.1

Author: Moises

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 Practica8_Vendedor_Visual
{
public partial class Form1 : Form
{
Vendedor [] compa = new Vendedor[25];
Arreglo A1 = new Arreglo(25);
int posmay, posmayor;

public Form1()
{
InitializeComponent();

groupBox1.Visible = true;
BtContinuar.Visible = false;
BtTerminar.Visible = false;
BtAceptar.Visible = true;
BtCancelar.Visible = true;
label4.Text = "";
label5.Text = "";

}

private void BtAceptar_Click(object sender, EventArgs e)
{
int no;
string nom;
double monto;

no = int.Parse(textBox1.Text);
nom = textBox2.Text;
monto = double.Parse(textBox3.Text);


Vendedor Vx = new Vendedor(no, nom, monto);
compa[no - 1] = Vx;

A1.AsignarDato(no, monto);
posmay = A1.Mayor(25);
posmayor = posmay;

BtContinuar.Visible = true;
BtTerminar.Visible = true;
BtAceptar.Visible = false;
BtCancelar.Visible = false;

}

private void BtTerminar_Click(object sender, EventArgs e)
{
int I;
listBox1.Visible = true;
groupBox1.Visible = false;
BtContinuar.Visible = false;
BtTerminar.Visible = false;
BtAceptar.Visible = false;
BtCancelar.Visible = false;
listBox1.Items.Add("No. Vendedor \tNombre Vendedor \tMonto Venta");
for (I = 0; I < 25; I++)
{
if (compa[I] != null)
{
listBox1.Items.Add("" + compa[I].ObtenerNo_Vend() + "\t\t" + compa[I].ObtenerNombre() + "\t\t" + compa[I].ObtenerVentaTotal());
}
}



label4.Text = "Primer mayor: "+posmayor.ToString() + " " + A1.ObtenerDato(posmayor).ToString();



A1.AsignarDato(posmayor, 0);

posmay = A1.Mayor(25);
posmayor = posmay;



label5.Text = "Segundo mayor: " + posmayor.ToString() + " " + A1.ObtenerDato(posmayor).ToString();



}
private void BtContinuar_Click(object sender, EventArgs e)
{
groupBox1.Visible = true;
BtContinuar.Visible = false;
BtTerminar.Visible = false;
BtAceptar.Visible = true;
BtCancelar.Visible = true;
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
}

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

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

 

Practica 8.3

Author: Moises

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 Practica8_Vendedor_Visual
{
public partial class Form1 : Form
{
Vendedor [] compa = new Vendedor[25];
Arreglo A1 = new Arreglo(25);
int posmay, posmayor;

public Form1()
{
InitializeComponent();

groupBox1.Visible = true;
BtContinuar.Visible = false;
BtTerminar.Visible = false;
BtAceptar.Visible = true;
BtCancelar.Visible = true;
label4.Text = "";
label5.Text = "";

}

private void BtAceptar_Click(object sender, EventArgs e)
{
int no;
string nom;
double monto;

no = int.Parse(textBox1.Text);
nom = textBox2.Text;
monto = double.Parse(textBox3.Text);


Vendedor Vx = new Vendedor(no, nom, monto);
compa[no - 1] = Vx;

A1.AsignarDato(no, monto);
posmay = A1.Mayor(25);
posmayor = posmay;

BtContinuar.Visible = true;
BtTerminar.Visible = true;
BtAceptar.Visible = false;
BtCancelar.Visible = false;

}

private void BtTerminar_Click(object sender, EventArgs e)
{
int I;
listBox1.Visible = true;
groupBox1.Visible = false;
BtContinuar.Visible = false;
BtTerminar.Visible = false;
BtAceptar.Visible = false;
BtCancelar.Visible = false;
listBox1.Items.Add("No. Vendedor \tNombre Vendedor \tMonto Venta");
for (I = 0; I < 25; I++)
{
if (compa[I] != null)
{
listBox1.Items.Add("" + compa[I].ObtenerNo_Vend() + "\t\t" + compa[I].ObtenerNombre() + "\t\t" + compa[I].ObtenerVentaTotal());
}
}



label4.Text = "Primer mayor: "+posmayor.ToString() + " " + A1.ObtenerDato(posmayor).ToString();



A1.AsignarDato(posmayor, 0);

posmay = A1.Mayor(25);
posmayor = posmay;



label5.Text = "Segundo mayor: " + posmayor.ToString() + " " + A1.ObtenerDato(posmayor).ToString();



}
private void BtContinuar_Click(object sender, EventArgs e)
{
groupBox1.Visible = true;
BtContinuar.Visible = false;
BtTerminar.Visible = false;
BtAceptar.Visible = true;
BtCancelar.Visible = true;
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
}

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

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