lunes, 8 de febrero de 2010

practica 3 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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
double grados, radianes;
public Form1()
{


InitializeComponent();
grados = radianes = 0.0;
}

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

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


practica 3 problema 2 visual

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
{
double lado, ancho, largo, lado1, lado2, lado3,radio, diametro, dma,dme,l;
public Form1()
{
InitializeComponent();
lado = ancho = largo = lado1 = lado2 = lado3 = radio = diametro=dma=dme=l = 0;
}

private void button1_Click(object sender, EventArgs e)
{
lado = double.Parse(textBox1.Text);
double a1 = lado * lado;
double p1 = 4 * lado;
label10.Text = "area = " + a1 + " perimetro= " + p1;

largo = double.Parse(textBox2.Text);

ancho = double.Parse(textBox3.Text);
double a2 = largo * ancho;
double p2 = (2 * largo) + (2 * ancho);
label11.Text = "area = " + a2 + " perimetro = " + p2;

lado1 = double.Parse(textBox4.Text);
lado2 = double.Parse(textBox5.Text);
lado3 = double.Parse(textBox6.Text);
double a3 = (lado1 * lado2) / 2;
double p3 = lado1 + lado2 + lado3;

label12.Text= "area = " + a3 + " perimetro = " + p3;
radio = double.Parse(textBox7.Text);
diametro = double.Parse(textBox8.Text);
double a4 = (radio * radio) * 3.1416;
double p4 = 3.1416 * diametro;
label16.Text = "area = " + a4 + " perimetro= " + p4;
dma = double.Parse(textBox9.Text);
dme = double.Parse(textBox10.Text);
l = double.Parse(textBox11.Text);
double a5= (dma * dme)/2;
double p5 = 4 * l;
label21.Text = "area = " + a5 + " perimetro= " + p5;
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label2.Text = " ";

textBox1.Focus();

}
private void label1_Click(object sender, EventArgs e)
{

}
}
}





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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
double radio;
double area;
double volumen;
public Form1()
{
InitializeComponent();
radio = 0;
area = 0;
volumen = 0;

}

private void button1_Click(object sender, EventArgs e)
{
radio = double.Parse(textBox1.Text);
area = (radio * radio) * 4 * 3.1416;
volumen = (radio * radio * radio) * 3.1416 * 4 / 3;
label3.Text = "area = " + area;
label4.Text = " volumen= " + volumen;

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

}
}
}

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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
double x;
double y;
public Form1()
{
InitializeComponent();
x = y = 0;
}

private void button1_Click(object sender, EventArgs e)
{
x = double.Parse(textBox1.Text);
y = (3 * (x * x)) + 9 * x - 20;
label3.Text = "y = " + y;
}

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

}
}
}

practica 3 problema 5 visual


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
{
double horas;
double minutos;

double segundos;
double dias;
public Form1()
{
InitializeComponent();
horas= minutos = segundos =dias;
}

private void button1_Click(object sender, EventArgs e)
{
horas = double.Parse(textBox1.Text);
minutos = horas * 60;
segundos = minutos * 60;
dias = horas / 24;
label2.Text = "minutos= " + minutos;
label3.Text = "segundos = " + segundos;
label4.Text = " dias = " + dias;
}

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

practica 3 problema 6 visual

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
{
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;
}
}
}

No hay comentarios:

Publicar un comentario