NUEVO EJEMPLO
import javax.swing.*;
public class OPERACIONES_MATEMATICAS {
public static void main(String args[])
{
ope n=new ope();
JOptionPane.showMessageDialog(null,"SENO DE 10 + 20: "+(double)n.seno(10, 20));
JOptionPane.showMessageDialog(null,"COSENO DE 10 20 30: "+(double)n.coseno(10, 20, 30));
JOptionPane.showMessageDialog(null,"TANGENTE DE 10 20: "+(double)n.tangente(10, 20));
JOptionPane.showMessageDialog(null,"RAIZ DE 5 20: "+(double)n.raiz(10, 20));
}
}
class ope
{
public double seno(double a,double b)
{
return Math.sin(a+b);
}
public double coseno(double a,double b,double c)
{
//operacion con tres parametros
return Math.cos(a+(b+5)*(c-3));//cada simbolo separa el parametro
}
public double tangente(double a,double b)
{
return Math.tan((a*2)+(b+10));
}
public double raiz(double a,double b)
{
return Math.sqrt(a+b);
}
}
Suscribirse a:
Enviar comentarios (Atom)
0 comentarios:
Publicar un comentario