jueves, 23 de abril de 2009

Practica 13



namespace ConsoleApplication1
{
class Subclase : ClaseMadre
{
public int c;
public void imprimir_c()
{
Console.WriteLine("c = {0}",c);
}
public void imprimirsuma()
{
Console.WriteLine("Suma= {0}",(a+b+c));
}
public void producto()
{
Console.WriteLine("Producto= {0}",(a*b*c));
}
public int calcularmayor()
{
int mayor=0;
if (a > b && a > c)
{
Console.WriteLine("Mayor es a: {0}", a); mayor= a;
}
if (b > a && b > c)
{
Console.WriteLine("Mayor es b: {0}", b); mayor= b;
}
if (c > a && c > b)
{
Console.WriteLine("Mayor es c: {0}", c); mayor= c;
}
if (a == b && a == c)
{
Console.WriteLine("Todos Iguales"); mayor= a;
}
if (a == b && a > c)
{
Console.WriteLine("Mayor a:{0} y b:{1}", a, b); mayor= a;
}
if (c == b && c > a)
{
Console.WriteLine("Mayor c:{0} y b:{1}", c, b); mayor= c;
}
if (a == c && a > b)
{
Console.WriteLine("Mayor a:{0} y c:{1}", a, c); mayor= a;
}
return mayor;
}
public int calcularmenor()
{
int menor=0;
if (a < b && a < c)
{
Console.WriteLine("Menor es a: {0}", a); menor= a;
}
if (b < a && b < c)
{
Console.WriteLine("Menor es b: {0}", b); menor= b;
}
if (c < a && c < b)
{
Console.WriteLine("Menor es c: {0}", c); menor= c;
}
if (a == b && a == c)
{
Console.WriteLine("Todos Iguales"); menor= a;
}
if (a == b && a < c)
{
Console.WriteLine("Menor a:{0} y b:{1}", a, b); menor= a;
}
if (c == b && c < a)
{
Console.WriteLine("Menor c:{0} y b:{1}", c, b); menor= c;
}
if (a == c && a < b)
{
Console.WriteLine("Menor a:{0} y c:{1}", a, c); menor= a;
}
return menor;
}
public void intervalo(int may,int men)
{
int mayor, menor, diferencia=0;
mayor = may; menor = men;
diferencia = mayor - menor;
Console.WriteLine("Intervalo= {0}",diferencia );
}
}
}

sábado, 4 de abril de 2009

practica 2




using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication1
{
class VentasTotalesMiniSuper
{
//Declaracion
double[] VentasTotales;
int i, mayIndice, menIndice;
double mayorVenta, menorVenta;
public VentasTotalesMiniSuper()
{
VentasTotales = new double[7];
}
public void asignarDato(int j, double dato)
{
VentasTotales[j]= dato;
}
public double obtenerDato(int j)
{
return VentasTotales[j];
}
public int ventaMayor()
{
mayorVenta = VentasTotales[0];
mayIndice = 0;
for (i = 1; i < 7; i = i + 1)
{
if (VentasTotales[i] > mayorVenta)
{
mayorVenta = VentasTotales[i];
mayIndice = i;
}
}
return mayIndice;
}
public int ventaMenor()
{
menorVenta = VentasTotales[0];
menIndice = 0;
for (i = 1; i < 7; i++)
{
if (VentasTotales[i] < menorVenta)
{
menorVenta = VentasTotales[i];
menIndice = i;
}
}
return menIndice;
}
public double intervalo()
{
return mayorVenta - menorVenta;
}

}
}

Practica 2



using System;
using System.Collections.Generic;
using System.Text;
namespace Aplicacion_de_Ventas_Semanal
{
class VentasTotalesMiniSuper
{
double[] VentasTotales;
int i, mayIndice, menIndice;
double mayorVenta, menorVenta;
public VentasTotalesMiniSuper()
{
VentasTotales = new double[7];
}
public void asignarDato(int j, double dato)
{
VentasTotales[j] = dato;
}
public double obtenerDato(int j)
{
return VentasTotales[j];
}
public int ventaMayor()
{
mayorVenta = VentasTotales[0];
mayIndice = 0;
for (i = 1; i < 7; i = i + 1)
{
if (VentasTotales[i] > mayorVenta)
{
mayorVenta = VentasTotales[i];
mayIndice = i;
}
}
return mayIndice;
}
public int ventaMenor()
{
menorVenta = VentasTotales[0];
menIndice = 0;
for (i = 1; i < 7; i++)
{
if (VentasTotales[i] < menorVenta)
{
menorVenta = VentasTotales[i];
menIndice = i;
}
}
return menIndice;
}
public double intervalo()
{
return mayorVenta - menorVenta;
}

}
}

miércoles, 1 de abril de 2009

practica3



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Venta_de_15_productos
{
class VentasProductos
{
double[] pedidos;
int[] inventario;
int[] codigo;
string[] nombreProd;
double[] preciosProd;
int[] ventaTotalProd;
int[] ventaTotalProd1;
int i, NoPedidos;
double promedio;
public VentasProductos()
{
inventario = new int[15] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 };
codigo = new int[15] { 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14 };
nombreProd = new string[15] { "xbox", "xbox 360", "play Station 3", "Pay Station 2", "Nintendo Wii", "Nintendo 64", "Mario Kart 64", "LapTopHp", "WOW III", "LapTopDell", "Super Smash Bros.", "super Smash Bros. Brawl", "Lap Top Hp", "Lap Top Dell", "God of War" };
preciosProd = new double[15] { 1500.00, 3250.70, 8899.95, 1750.64, 4950.45, 789.99, 320.00, 220.99, 320.50, 1199.99, 459.99, 789.98, 1499.90, 1789.95, 1200.43 };
ventaTotalProd = new int[15];
ventaTotalProd1 = new int[15];
pedidos = new double[15];
i = NoPedidos = 0;
}
public double mostrarpreciopedidos(int k)
{
return pedidos[k];
}
public void asignarpedidodinero(int k, double l)
{
pedidos[k] = pedidos[k] + l;
}
public string obtenerNombreProd(int j)
{
return nombreProd[j];
}
public int obtenerCodigo(int j)
{
return codigo[j];
}
public double obtenerPreciosProd(int j)
{
return preciosProd[j];
}
public void asignarVentaTotalProd(int j, int dato)
{
ventaTotalProd[j] = ventaTotalProd[j] + dato;
ventaTotalProd1[j] = ventaTotalProd1[j] + dato;
}
public void incrementaPedido()
{
NoPedidos++;
}
public int obtenerPedido()
{
return NoPedidos;
}
public double precioTotal(int k)
{
double precio;
precio = ventaTotalProd1[k] * preciosProd[k];
return precio;
}
public void cero(int k)
{
ventaTotalProd1[k] = 0;
}
public double ventaTotalPedidos()
{
double suma = 0.0;
for (i = 0; i < suma =" suma" total =" inventario[j];" suma =" 0.0;" i =" 0;" suma =" suma" promedio =" (suma" mayproduct =" ventaTotalProd[0];" mayindice =" 0;" i =" 1;"> mayproduct)
{
mayproduct = ventaTotalProd[i];
mayIndice = i;
}
}
nombre = nombreProd[mayIndice];
return nombre;
}
public string productoMenosVendido()
{
string nombre;
double mayproduct;
int mayIndice;
mayproduct = ventaTotalProd[0];
mayIndice = 0;
for (i = 1; i < mayproduct =" ventaTotalProd[i];" mayindice =" i;" nombre =" nombreProd[mayIndice];" desviacion =" ventaTotalProd[k]" mayproduct =" pedidos[0];" mayindice =" 0;" i =" 1;"> mayproduct)
{
mayproduct = pedidos[i];
mayIndice = i;
}
}
return mayIndice + 1;
}
}
}

Practica11



using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
class empleado
{
string nombre;
double horas;
int no_empleado;
float tasa;
public empleado(string name,int no, double hrs, float tas)
{
nombre = name;
horas = hrs;
no_empleado = no;
tasa = tas;
}
public empleado()
{
nombre = "";
horas = 0.0;
no_empleado = 0;
tasa = 0.0f;
}

public string obtenernombre()
{
return nombre;
}
public double obtenerhoras()
{
return horas;
}
public int obtenernumero()
{
return no_empleado;
}
public float obtenertasa()
{
return tasa;
}
public void eliminarempleado()
{
nombre = "";
horas = 0.0;
no_empleado = 0;
tasa = 0.0f;
}
}
}