PSEUDOCODIGO:
INICIO
rectangulo r1 = new rectangulo();
r1.Asignardatos(20,10);
Print("AREA= {0}", r1.Area());
Print("PERIMETRO= {0}", r1.Perimetro());
rectangulo r2 = new rectangulo();
double l1, l2;
Print"INTRODUCE LARGO DEL RECTANGULO. ";
Read l1
r2.Asignarlargo(l1);
Print"INTRODUCE ANCHO DE RECATANGULO. ";
Read l2
r2.Asignarancho(l2);
Print"REACTANGULO 2";
Print"LARGO={0}", r2.Obtenerlargo();
Prin("ANCHO={0}", r2.Obtenerancho();
Print"AREA={0}", r2.Area());
Print"PREIMETRO={0}", r2.Perimetro();
FIN
CONSOLA
rectangulo r1 = new rectangulo();
r1.Asignardatos(20,10);
Console.WriteLine("AREA= {0}", r1.Area());
Console.WriteLine("PERIMETRO= {0}", r1.Perimetro());
rectangulo r2 = new rectangulo();
double l1, l2;
Console.Write("INTRODUCE LARGO DEL RECTANGULO. ");
l1 = double.Parse(Console.ReadLine());
r2.Asignarlargo(l1);
Console.Write("INTRODUCE ANCHO DE RECATANGULO. ");
l2 = double.Parse(Console.ReadLine());
r2.Asignarancho(l2);
Console.WriteLine("REACTANGULO 2");
Console.WriteLine("LARGO={0}", r2.Obtenerlargo());
Console.WriteLine("ANCHO={0}", r2.Obtenerancho());
Console.WriteLine("AREA={0}", r2.Area());
Console.WriteLine("PREIMETRO={0}", r2.Perimetro());
Console.ReadLine();
VISUAL
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Focus();
double h, w;
rectangulo r1 = new rectangulo();
h = double.Parse(textBox1.Text);
w = double.Parse(textBox2.Text);
r1.Asignarancho(w);
r1.Asignarlargo(h);
textBox3.Text = ("El perimetro es = " + r1.Perimetro());
textBox4.Text = ("El areala es = " + r1.Area());
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
private void Form1_Load(object sender, EventArgs e)
{
}
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario