import java.lang.*;
import java.util.Random;
import java.io.*;
import java.math.*;
class Cero extends Exception
{
Cero()
{
super ("\n\nERROR EN DIVICION...");
}
}
class Neg extends Exception
{
Neg()
{
super ("\n\nERROR EN RAIZ...");
}
}
class Log extends Exception
{
Log()
{
super ("\n\nERROR EN LOG...");
}
}
class R
{
double a,b;
R()
{
Random r =new Random();
a=r.nextInt(10);
b=r.nextInt(10);
// a=10;
// b=0;
System.out.print("\nA= "+a);
System.out.print("\nB= "+b);
}
public double div() throws Cero
{
if(b==0)
throw new Cero();
else
return(a/b);
}
public double raiz() throws Neg
{
if(a<0)
throw new Neg();
else
return(Math.sqrt(a));
}
public double log() throws Log
{
if(a<=0)
throw new Log();
else
return(Math.log(a));
}
}
class pro2
{
public static void main(String [] args)
{
R r;
double d,ra,l;
r = new R();
try
{
d=r.div();
System.out.print("\nDIVICION: "+r.a+"/"+r.b+" = "+d);
}
catch(Cero e)
{
System.out.println(e.getMessage());
}
try
{
ra=r.raiz();
System.out.print("\nRAIZ: "+r.a+" = "+ra);
}
catch(Neg e)
{
System.out.println(e.getMessage());
}
try
{
l=r.log();
System.out.print("\nLOGARITMO: "+r.a+" = "+l);
}
catch(Log e)
{
System.out.println(e.getMessage());
}
}
}