domingo, 7 de diciembre de 2008

Examen

Problema 1 en console

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

namespace evaluacion_problema_1
{
class Program
{
static void Main(string[] args)
{
int m, n, p;
double Rt;
Console.WriteLine("introdusca las cantidades de resistencias");
Console.WriteLine("resistencia de 56 ohms");
m = int.Parse(Console.ReadLine());
Console.WriteLine("resistencia de 33 ohms");
n = int.Parse(Console.ReadLine());
Console.WriteLine("resistencia de 15 ohms");
p = int.Parse(Console.ReadLine());
Rt = (m * 56) + (n * 33) + (p * 15);
Console.WriteLine("resistencia total es" + Rt);
Console.ReadLine();
}
}
}




Problema 1 en windows

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace evaluacion_poblema_1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double Rt;
int m, n, p;
m = int.Parse(textBox1.Text);
n = int.Parse(textBox2.Text);
p = int.Parse(textBox3.Text);
Rt= m * 56 + n * 33 + p * 15;
textBox4.Text = Rt.ToString();



}
}
}




Problema 2 en console

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

namespace evaluacion_problema_2
{
class Program
{
static void Main(string[] args)
{
double angulo;
Console.WriteLine("introduce angulo en grados:");
angulo = double.Parse(Console.ReadLine());
if (angulo <> 90)
{
Console.WriteLine("el angulo es obtuso");
}
else
{
Console.WriteLine("el angulo es recto");
}
}
Console.ReadLine();
}
}
}





Problema 2 en windows

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace evaluacion_problema_2_window
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
int angulo;
angulo = int.Parse(textBox1.Text);
if (angulo <> 90)
{
MessageBox.Show("el angulo es OBTUSO");
}
else
{
MessageBox.Show("El angulo es RECTO");
}
}

}
}
}


Practica 6

Problema 1 en console

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

namespace practica_6_trabajo_1_console
{
class Program
{
static void Main(string[] args)
{
int x, y;
Console.WriteLine("Introdusca un valor entero para x");
Console.Write("X= ");
x = int.Parse(Console.ReadLine());
if (x < 0)

{
y = 3 * x + 6;
}


else

{
y = x * x + 6;
}
Console.WriteLine("\nEl valor de Y = "+y);
Console.ReadLine();

}
}
}



Problema 1 en windows

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

private void button1_Click(object sender, EventArgs e)
{
int x, y;
x = int.Parse(textBox1.Text);
if (x < 0)
{
y = 3 * x + 6;
}
else
{
y = x * x + 6;
}
MessageBox.Show("Y es igual a: " + y);


}
}
}

Problema 2 en console


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

namespace practica_6trabajo_2
{
class Program
{
static void Main(string[] args)
{
string des;
int cp;
double preuni, descuento, total;
Console.WriteLine("Introdusca los sig. valores");
Console.Write("\ndescripcion articulo: ");
des = Console.ReadLine();
Console.Write("\nCantidad pedida: ");
cp = int.Parse(Console.ReadLine());
Console.Write("\nprecio unitario: ");
preuni = double.Parse(Console.ReadLine());
descuento = 0.0;
if (cp > 50)
{
descuento = preuni * 0.15;
}
total = cp * (preuni - descuento);
Console.WriteLine("\n\nDescripcion: "+des+" \n\nCantidad: "+cp+" \n\nPrecio: "+preuni+" \n\nDescuento: "+descuento+" \n\ntotal: "+total);
Console.WriteLine("\n\nArticulo "+des+ " Pedida "+cp+ " Unitario: "+preuni);
Console.ReadLine();

}
}
}


Problema 2 en windows

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

private void button1_Click(object sender, EventArgs e)
{
int cp;
double preuni, descuento, total;
cp = int.Parse(textBox2.Text);
preuni=double.Parse(textBox3.Text);
descuento = 0.0;
if (cp > 50)
{
descuento = (preuni*cp)* 0.15;
}
total = (preuni * cp) - descuento;
textBox4.Text = descuento.ToString();
textBox5.Text = total.ToString();


}
}
}




Problema 3 en windows


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

private void button1_Click(object sender, EventArgs e)
{
double phs, pv, pa, total, descuento1;
int chs, cv, ca;

phs = double.Parse(textBox1.Text);
chs = int.Parse(textBox2.Text);
pv = double.Parse(textBox3.Text);
cv = int.Parse(textBox4.Text);
pa = double.Parse(textBox5.Text);
ca = int.Parse(textBox6.Text);
descuento1 = (phs * chs) * (0.80) + (pv * cv) * (0.85) + (pa * ca);
total = descuento1*0.93;
textBox7.Text = total.ToString();



}

private void button2_Click(object sender, EventArgs e)
{
double phs, pv, pa, total, descuento1;
int chs, cv, ca;

phs = double.Parse(textBox1.Text);
chs = int.Parse(textBox2.Text);
pv = double.Parse(textBox3.Text);
cv = int.Parse(textBox4.Text);
pa = double.Parse(textBox5.Text);
ca = int.Parse(textBox6.Text);
descuento1 = (phs * chs) * (0.80) + (pv * cv) * (0.85) + (pa * ca);
total = descuento1;
textBox7.Text = total.ToString();
}
}
}



Problema 4 en console

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

namespace practica_6trabajo_4
{
class Program
{
static void Main(string[] args)
{
double cal1, cal2, cal3, promedio;
string nombre;
Console.WriteLine("NOMBRE DEL ALUMNO");
nombre = Console.ReadLine();
Console.WriteLine("\n\ncalificacion 1:");
cal1 = double.Parse(Console.ReadLine());
Console.WriteLine("\n\nCalificacion 2:");
cal2 = double.Parse(Console.ReadLine());
Console.WriteLine("\nCalificacion 3:");
cal3 = double.Parse(Console.ReadLine());
promedio = (cal1 + cal2 + cal3) / 3;
if (promedio <= 70)
{
Console.WriteLine(nombre + " NO Acredito");
}
else
{
Console.WriteLine(nombre + " Acredito");
}


Console.ReadLine();

}
}
}



Problema 4 en windows

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

private void button1_Click(object sender, EventArgs e)
{
string nombre;
double cal1, cal2, cal3, prom;
nombre = textBox1.Text;
cal1 = double.Parse(textBox2.Text);
cal2 = double.Parse(textBox3.Text);
cal3 = double.Parse(textBox4.Text);
prom=(cal1+cal2+cal3)/3;
if (prom <= 70)
{
MessageBox.Show(nombre + " NO ACREDITADO");
}
else
{
MessageBox.Show(nombre + " ACREDITADO");
}
}
}
}

Practica 5

Problema 1 en console

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

namespace practica_5_trabajo_1
{
class Program
{
static void Main(string[] args)
{
int valor1, valor2;
Console.WriteLine("Introdusca 2 numeros enteros diferentes");
Console.Write("numero1=");
valor1 = int.Parse(Console.ReadLine());
Console.Write("numero2=");
valor2 = int.Parse(Console.ReadLine());
if (valor1 > valor2)
{
Console.WriteLine("\nel primer numero es mayor");
}
else
{
Console.WriteLine("\nel primer numero es menor");
}
Console.ReadLine();
}
}
}






Prolema 2 en console

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

namespace practica_5_trabajo_2
{
class Program
{
static void Main(string[] args)
{
double tiempo, P;
Console.WriteLine("Introduce valor de Tiempo");
tiempo = double.Parse(Console.ReadLine());
if (tiempo <= 35.00) { P = 0.46 * tiempo; } else { P = 0.19 * tiempo + 9.45; } Console.WriteLine("\nla presion es " + P + "psi"); Console.ReadLine(); } } }

Problema 3 en windows

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

private void button1_Click(object sender, EventArgs e)
{
int numero = int.Parse(textBox1.Text);
if (numero % 2 == 0)
{
label1.Text = "El numero es par";
}
else
{
label1.Text = "El numero es inpar";
}

}

private void button2_Click(object sender, EventArgs e)
{
label1.Text = "Introdusca un numero";
textBox1.Clear();
textBox1.Focus();
}
}
}




Problema 4 en windows

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

private void button1_Click(object sender, EventArgs e)
{
double largo, ancho, area, precio, precio_total;
largo = double.Parse(textBox1.Text);
ancho = double.Parse(textBox2.Text);
precio = double.Parse(textBox3.Text);
area = largo * ancho;
if (area <= 400.00) { precio_total = area * precio; } else { precio_total = area * (precio - precio * 0.10); } textBox4.Text = precio_total.ToString(); } } }

practica 4

Problema 1 en console

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

namespace practica_4_trabajo_1
{
class Program
{
static void Main(string[] args)
{
double peso, dolar, contD;
Console.WriteLine("Escriba el tipo de cambio");
dolar = double.Parse(Console.ReadLine());
Console.WriteLine("\ncantidad de pesos: ");
peso = double.Parse(Console.ReadLine());
contD = peso / dolar;
Console.WriteLine("\ncantida en dolares: "+contD);
Console.ReadLine();

}
}
}



Problema 1 en windows

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

private void button1_Click(object sender, EventArgs e)
{
double pesos, dolar, cantD;
pesos = double.Parse(textBox2.Text);
dolar = double.Parse(textBox1.Text);
cantD = pesos / dolar;
textBox3.Text = cantD.ToString();

}
}
}




Problema 2 en console

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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double C, F;
Console.WriteLine("introdusca el valor de grados Centigrados");
Console.Write("C= ");
C = double.Parse(Console.ReadLine());
F = (9.0 / 5.0) * C + 32.0;
Console.WriteLine("\nla conversion a grados Fahrenheit es: " + F);
Console.ReadLine();
}
}
}



Problema 2 en windows

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

private void button1_Click(object sender, EventArgs e)
{
double C, F;
C = double.Parse(textBox1.Text);
F = (9.0 / 5.0) * C + 32.0;
textBox2.Text = F.ToString();
}
}
}





Problema 3 en consola

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

namespace practica_4_trabajo_3_console
{
class Program
{
static void Main(string[] args)
{
double pies, yardas, pulgadas, centimetros, metros;
Console.WriteLine("ingresar cantidad de pies a convertir:");
pies = int.Parse(Console.ReadLine());
yardas = pies / 3;
Console.WriteLine("\nEquivale a " + yardas+" yardas");
pulgadas = pies * 12;
Console.WriteLine("\nEquivale a " + pulgadas + " pulgadas");
centimetros = pies * 30.48;
Console.WriteLine("\nEquivale a "+centimetros+" centimetros");
metros=0.3048*pies;
Console.WriteLine("\nEquivale a " + metros + " metros");
Console.ReadLine();


}
}
}




Problema 3 en windows

System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace practica_4_trabajo_3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{

double pies, yardas, pulgadas, centimetros, metros;
pies = double.Parse(textBox1.Text);
yardas = pies / 3;
textBox2.Text = yardas.ToString();
pulgadas = pies * 12;
textBox3.Text = pulgadas.ToString();
centimetros = pies * 30.48;
textBox4.Text = centimetros.ToString();
metros = pies * 0.3048;
textBox5.Text = metros.ToString();



}

}

}


jueves, 4 de diciembre de 2008

Practica 3

Problema 1

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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Bienvenido a la practicavisual en c# " + textBox1.Text);
}
}
}

Problema 2

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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int h, w;h = int.Parse(textBox1.Text);
w = int.Parse(textBox2.Text);
int Ar = h * w;
int Pe = 2 * (h + w);
textBox3.Text = Ar.ToString();
textBox4.Text = Pe.ToString();
}
}
}

Practica 2

Problema 1
using System;
using System.Collections.Generic;
using System.Text;
namespace practica_2_problema_1
{
class Program
{
static void Main(string[] args)
{
int n1, n2, n3, n4, promedio, producto;
Console.WriteLine("introduce 4 valores enteros");
n1 = int.Parse(Console.ReadLine());
n2 = int.Parse(Console.ReadLine());
n3 = int.Parse(Console.ReadLine());
n4 = int.Parse(Console.ReadLine());
promedio = n1 + n2 + n3 + n4 / 4;
producto = n1 * n2 * n3 * n4;
Console.WriteLine("el promedio de " + n1 + "," + n2 + "," + n3 + "," + n4 + " es igual a :" + promedio);
Console.WriteLine("el producto de" + n1 + "*" + n2 + "*" + n3 + "*" + n4 + " es igual a : " + producto);
Console.ReadLine();
}
}
}


Problema 2



using System;
using System.Collections.Generic;
using System.Text;
namespace practica_2_problema_2
{
class Program
{
static void Main(string[] args)
{
int A, B, C, D, E, F, X, Y;
Console.WriteLine("introduce los siguientes valores");
Console.WriteLine("A");
Console.WriteLine("B");
Console.WriteLine("C");
Console.WriteLine("D");
Console.WriteLine("E");
Console.WriteLine("F");
A = int.Parse(Console.ReadLine());
B = int.Parse(Console.ReadLine());
C = int.Parse(Console.ReadLine());
D = int.Parse(Console.ReadLine());
E = int.Parse(Console.ReadLine());
F = int.Parse(Console.ReadLine());
X = (C * E - B * F) / (A * E - B * D);
Y = (A * F - C * D) / (A * E - B * D);
Console.WriteLine("X = " + X);
Console.WriteLine("Y = " + Y);
Console.ReadLine();
}
}
}







Problema 3


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int x1, y1, x2, y2, pendiente;
Console.WriteLine("introduce las cordenadas");
Console.Write("x1=");
x1 = int.Parse(Console.ReadLine());
Console.Write("y1=");
y1 = int.Parse(Console.ReadLine());
Console.Write("x2=");
x2 = int.Parse(Console.ReadLine());
Console.Write("y2=");
y2 = int.Parse(Console.ReadLine());
pendiente = (y2 - y1) / (x2 - x1);
Console.WriteLine("pendiente es " + pendiente);
Console.ReadLine();
}
}
}




Problema 4

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace practica__ejercicio_4
{
class Program
{
static void Main()
{
int x1, y1, x2, y2, x, y;
Console.WriteLine("introdusca las cordenadas");
Console.Write("x1=");

x1 = int.Parse(Console.ReadLine());
Console.Write("y1=");
y1 = int.Parse(Console.ReadLine());
Console.Write("x2=");
x2 = int.Parse(Console.ReadLine());
Console.Write("y2=");
y2 = int.Parse(Console.ReadLine());
x = (x1 + x2) / 2;
y = (y1 + y2) / 2;
Console.WriteLine("Las cordenadas de x en el punto medio es" + x);
Console.WriteLine("las cordenadas de y en el punto medio es" + y);
Console.ReadLine();


}
}
}







Practica 1

Problema 1
using System;
using System.Collections.Generic;
using System.Text;

namespace practica_1_problema_1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Instituto Tecnologico de Tijuana");
Console.WriteLine("Ing. electronica");
Console.WriteLine("Materia: electronica");
Console.WriteLine("Tema: Practica1A");
Console.WriteLine("Nombre del alumno: Martin Lopez");
Console.WriteLine("Fecha: 13 de octube 2008");
Console.ReadLine();
}
}
}

Problema 2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace trabajo_1_practica_2
{
class Program
{
static void Main(string[] args)
{
string Nombre;
Console.WriteLine("hola, como te llamas ");
Nombre = Console.ReadLine();
Console.WriteLine("\n\n Bienvenido " + Nombre);
Console.WriteLine("Seamos amigos!");
Console.ReadLine();
}
}
}
Problema 3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace pract_1_trbj_3
{
class Program
{
static void Main(string[] args)
{
double Radio, Volumen, Area;
Console.WriteLine("Introdusca el radio de una esfera");
Console.Write("R=");
Radio = double.Parse(Console.ReadLine());
Volumen = 4 * Math.PI * Math.Pow(Radio, 3) / 3;
Area = 4 * Math.PI * Math.Pow(Radio, 2);
Console.WriteLine("El Volumen de una esfera esfera: " + Volumen);
Console.WriteLine("El area de una esfera es: " + Area);
Console.ReadLine();
}
}
}
Problema 4
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace paractica_1_trabajo_4{ class Program
{
static void Main(string[] args)
{
int n1, n2, n3, Suma, Promedio, Producto;
Console.WriteLine("Introdusca 3 valores enteros");
Console.Write("n1=");
n1 = int.Parse(Console.ReadLine());
Console.Write("n2=");
n2 = int.Parse(Console.ReadLine());
Console.Write("n3=");
n3 = int.Parse(Console.ReadLine());
Suma = n1 + n2 + n3;
Promedio = Suma / 3;
Producto = n1 * n2 * n3;
Console.WriteLine("La Suma de " + n1 + "+" + n2 + "+" + n3 + "=" + Suma);
Console.WriteLine("El promedio es: " + Promedio);
Console.WriteLine("El producto de " + n1 + "x" + n2 + "x" + n3 + "=" + Producto);
Console.ReadLine();
}
}
}