public class EcuacionC//nombre de clase
{
int a ;
int b; //atributos
int c;
double d;
EcuacionC() //costructor prodefaul
{
}
EcuacionC(int m,int n,int o,double p)
{
a=m;
b=n;
c=o; //cosntructor para inicializar un
d=p;
}
double calc_x1()
{
double x1;
x1=(-b+Math.sqrt(d))/(2*a);
return x1;
}//metodos o operaciones calc_x1
double calc_x2()
{
double x2;
x2=(-b-Math.sqrt(d))/(2*a);
return x2;
}//calc_x2
double calc_dis()
{
d=(b*b) - (4*a*c);
return d;
}//calc_dis
double calc_xiguales()
{
double x;
x=-b/(2*a);
return x;
}//calc_xiguales
void avisa_imaginarias()
{
System.out.println("raices imaginarias");
}//avisa_imaginarias
void set_a(int m)
{
a=m;
} //set a
void set_b (int n)
{
b=n;
}//set b
void set_c (int o)
{
c=o;
}//set c
}//de la clase
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.