miércoles, 10 de febrero de 2010

Practica 3 en "visual"

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 practica_3_problema_1_visual
{
public partial class Form1 : Form
{
double numero, radianes;
public Form1()
{
InitializeComponent();
numero = 0;
radianes = 0.0;
}

private void button1_Click(object sender, EventArgs e)
{
numero = double.Parse(textBox1.Text);
radianes = numero * 3.1416 / 180;
label2.Text = "radianes es:" + radianes;

}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = " ";
}

private void label1_Click(object sender, EventArgs e)
{

}
}
}

Practica 3 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 practica_3_problema_2_visual
{
public partial class Form1 : Form
{
//valores del cuadro
double numero, perimetro, area;
//valores del rectangulo
double b, altura, perimetro1, area1;
//valores del triangulo
double b2, altura2, lado2, lado3, perimetro2, area2;
//valores del circulo
double radio, perimetro3, area3;
//valores del rombo
double lado, D, d, perimetro4, area4;



public Form1()
{
InitializeComponent();
numero = 0;
perimetro = 0.0;
area = 0.0;
b = 0;
altura = 0;
perimetro1 = 0.0;
area1 = 0.0;
b2 = 0;
lado2 = 0;
lado3 = 0;
altura2 = 0;
perimetro2 = 0.0;
area2 = 0.0;
radio = 0;
perimetro3 = 0.0;
area3 = 0.0;
lado = 0;
D = 0;
d = 0;
perimetro4 = 0.0;
area4 = 0.0;

}

private void label3_Click(object sender, EventArgs e)
{

}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
numero = double.Parse(textBox1.Text);
perimetro = numero * 4;
area = numero * numero;
label3.Text = "perimetro=" + perimetro;
label4.Text = "area=" + area;
b = double.Parse(textBox2.Text);
altura = double.Parse(textBox3.Text);
perimetro1 = b * 2 + altura * 2;
area1 = b * altura;
label8.Text = "perimetro=" + perimetro1;
label9.Text = "area=" + area1;
b2 = double.Parse(textBox4.Text);
lado2=double.Parse(textBox5.Text);
lado3 = double.Parse(textBox6.Text);
altura2 = double.Parse(textBox7.Text);
perimetro2=b2+lado2+lado3;
area2=b2*altura2/2;
label15.Text="perimetro="+perimetro2;
label16.Text="area="+area2;
radio = double.Parse(textBox8.Text);
perimetro3 = 2 * 3.1416*radio;
area3 = 3.1416 * radio * radio;
label18.Text = "perimetro=" + perimetro3;
label19.Text = "area=" + area3;
lado = double.Parse(textBox9.Text);
D = double.Parse(textBox10.Text);
d = double.Parse(textBox11.Text);
perimetro4 = 4 * lado;
area4 = D * d / 2;
label25.Text = "perimetro=" + perimetro4;
label26.Text = "area =" + area4;
}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
textBox6.Clear();
textBox7.Clear();
textBox8.Clear();
textBox9.Clear();
textBox10.Clear();
textBox11.Clear();
label3.Text = " ";
label4.Text = " ";
label8.Text = " ";
label9.Text = " ";
label15.Text = " ";
label16.Text = " ";
label18.Text = " ";
label19.Text = " ";
label25.Text = " ";
label26.Text = " ";

{

}
}
}


Practica 3 problema 3

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_3_problema_3_visual
{
public partial class Form1 : Form
{
double numero, area, volumen;
public Form1()
{
InitializeComponent();
numero = 0;
area = 0.0;
volumen = 0.0;
}

private void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
{

}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
numero = double.Parse(textBox1.Text);
area = numero * numero * 4 * 3.1416;
volumen = 4 / 3 * 3.1416 * numero * numero * numero;
label3.Text = "Area de la esfera es:" + area;
label4.Text = "Volumen de la esfera es:" + volumen;
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label3.Text = " ";
label4.Text = " ";

}
}
}



Practica 3 problema 4

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_3_problema_4_visual
{
public partial class Form1 : Form
{
double x,y;


public Form1()
{
InitializeComponent();
x = 0;
y = 0.0;
}
private void button1_Click(object sender, EventArgs e)
{
x = double.Parse(textBox1.Text);
y = 3 * x * x + 9 * x - 20;
label3.Text = "Valor de y es:" + y;
}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label3.Text = " ";
}
}
}



Practica 3 problema 5

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_3_problema_5_visual
{
public partial class Form1 : Form
{
double hora, minutos, segundos, dias;


public Form1()
{
InitializeComponent();
hora = 0;
minutos = 0.0f;
segundos = 0.0f;
dias = 0.0f;
}

private void label2_Click(object sender, EventArgs e)
{

}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
hora = double.Parse(textBox1.Text);
minutos = hora * 60.0;
segundos = minutos * 60.0;
dias = hora / 24;
label3.Text = "horas a minutos son:" + minutos;
label4.Text = "horas a segundos son:" + segundos;
label5.Text = "horas a dias son:" + dias;

}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label3.Text = " ";
label4.Text = " ";
label5.Text = " ";
}
}
}




Practica 3 problema 6

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_3_problema_6_visual
{
public partial class Form1 : Form
{
string des;
int numero;
float costoart;
public Form1()
{
InitializeComponent();
des=" ";
numero=0;
costoart=0.0f;
}
private void button1_Click(object sender, EventArgs e)
{
des = textBox1.Text;
numero = int.Parse(textBox2.Text);
costoart = numero * 3.5f + 10700.0f;
label3.Text = "costo producto del articulo" + des + "es:" + costoart;
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
label3.Text = " ";
}
}
}







No hay comentarios:

Publicar un comentario