using System;
using System.Collections.Generic;
using System.Text;
namespace EXAMEN_3ERA_UNIDAD
{
public class PUNTO
{
public int x1, x2, y1, y2;
public PUNTO() { }
public PUNTO(int x1, int x2, int y1, int y2)
{
this.x1 = x1;
this.x2 = x2;
this.y1 = y1;
this.y2 = y2;
}
public virtual double area()
{
return 0;
}
public virtual double distancia()
{
return 0;
}
public class CIRCULO : PUNTO
{
public int X1, X2, Y1, Y2;
public double radio;
public CIRCULO()
{
}
public CIRCULO(int x1, int x2, int y1, int y2)
: base(x1, x2, y1, y2)
{
X1 = x1;
X2 = x2;
Y1 = y1;
Y2 = y2;
}
public void Radio(double radio)
{
this.radio = radio;
}
public override double distancia()
{
return Math.Sqrt((Math.Pow((X2 - X1), 2)) + (Math.Pow((Y2 - Y1), 2)));
//Math.Sqrt((X2 - X1)* 2 + (Y2 -Y1)* 2);
}
public override double area()
{
return Math.PI * Math.Pow(radio, 2);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace EXAMEN_3ERA_UNIDAD
{
class Program
{
static void Main(string[] args)
{
double radio;
Console.Write("Introduce x1: ");
int x1=Int32.Parse(Console.ReadLine());
Console.Write("Introduce x2: ");
int x2=Int32.Parse(Console.ReadLine());
Console.Write("Introduce y1: ");
int y1=Int32.Parse(Console.ReadLine());
Console.Write("Introduce y2: ");
int y2=Int32.Parse(Console.ReadLine());
PUNTO p = new PUNTO(x1, x2, y1, y2);
CIRCULO circ2 = new CIRCULO();
CIRCULO circ = new CIRCULO();
Console.Write("Captura Radio x1y1: ");
double radio1 = Double.Parse(Console.ReadLine());
circ2.Radio(radio1);
Console.Write("Captura Radio x2y2: ");
radio = Double.Parse(Console.ReadLine());
circ.Radio(radio);
Console.WriteLine("\nel area del circulo x1y1 : {0}", circ.area());
Console.WriteLine("\nel area del circulo x1y1 : {0}", circ2.area());
Console.WriteLine("\nla distancia de estos circulos por las rectas x1y1 y y1y2 es : {0}", circ.distancia());
Console.ReadLine();
}
}
}
Tuesday, December 2, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment