
lunes, 28 de septiembre de 2009
Practica 1.1 Visual

Practica 2.1 Consola


using System;
usingSystem.Collections.Generic;
using System.Text;
namespacepractica_2_console_R
{
class Program
{
static void Main(string[] args)
{
int n, m, p, rs;
Console.WriteLine("\t\t\tMedidor de Resistencias");
Console.WriteLine("\n\nIntroduce resistencia de 56 ohms");
n = int.Parse(Console.ReadLine());
Console.WriteLine("Intruduce resistencia de 33 ohms");
m = int.Parse(Console.ReadLine());
Console.WriteLine("Introduce resistencia de 15 ohms");
p = int.Parse(Console.ReadLine());
rs = n * 56 + m * 33 + p * 15;
Console.WriteLine("La resistencia Total En Serie Es{0}", rs);
Console.ReadKey();
}
}
}
Practica 2.1 Visual

using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
usingSystem.Windows.Forms;
namespaceWindows2_1_practica_2
{
public partial class Form1 : Form
{
int n, m, p, rs;
public Form1()
{
n = m = p = rs = 0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
n = int.Parse(textBox1.Text);
m = int.Parse(textBox2.Text);
p = int.Parse(textBox3.Text);
rs = n * 56 + m * 33 + p * 15;
textBox4.Text = "la Resistencia Total En serie es:" + rs.ToString();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
}
}
}
Practica 2.2 Consola


namespacepractica_2_2_console_dist
{
class Program
{
static void Main(string[] args)
{
int distancia, vel, tiempo;
Console.WriteLine("Programa que Calcula La Distancia En Millas");
Console.WriteLine("Introduce el Valor entero De La Velocidad De Viaje");
vel = int.Parse(Console.ReadLine());
Console.WriteLine("Introduce El Valor entero Que Representa El Tiempo Transcurrido");
tiempo = int.Parse(Console.ReadLine());
distancia = vel * tiempo;
Console.WriteLine("La distancia Total es{0}millas", distancia);
Console.ReadKey();
}
}
}
Practica 2.2 Visual

using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
usingSystem.Windows.Forms;
namespaceWindows2_3_practica_2
{
public partial class Form1 : Form
{
int v, t, d;
public Form1()
{
InitializeComponent();
v = t = d = 0;
}
private void label3_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
v = int.Parse(textBox1.Text);
t = int.Parse(textBox2.Text);
d = v * t;
textBox3.Text = d.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}
Practica 2.3 Consola


using System;
usingSystem.Collections.Generic;
using System.Linq;
using System.Text;
namespaceconsole_2_3_vend_practica_2
{
class Program
{
static void Main(string[] args)
{
double costoauto, costototal;
Console.WriteLine("Introduce Costo del Auto");
costoauto = double.Parse(Console.ReadLine());
double ganancia = costoauto * 0.12;
double impuesto = costoauto * 0.06;
costototal = costoauto + ganancia + impuesto;
Console.WriteLine("costo auto={0} \n ganancia vendedor={1} \n impuesto={2} \n costo total={3}", costoauto, ganancia, impuesto, costototal);
Console.ReadKey();
}
}
Practica 2.3 Visual

using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
usingSystem.Windows.Forms;
namespaceWindows2_33practica_2
{
public partial class Form1 :Form
{
double costo, costototal;
public Form1()
{
costo = costototal = 0;
InitializeComponent();
}
private voidbutton1_Click(objectsender, EventArgs e)
{
costo =double.Parse(textBox1.Text);
costototal = costo + costo * 0.12 + costo * 0.06;
textBox2.Text = costototal.ToString();
}
private voidbutton2_Click(objectsender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox1.Focus();
}
private voidbutton3_Click(objectsender, EventArgs e)
{
Close();
}
}
}
