Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @file VolumenCono.java
- * @version 0.0.1
- * @author Ariel Carraro
- * @date 26-enero-2013
- * @url
- * @description Programa que calcula el volumen de un cono
- */
- import javax.swing.JOptionPane;
- import javax.swing.*;
- public class VolumenCono{
- public static void main(String[] args) {
- try{
- double radio=Double.parseDouble(JOptionPane.showInputDialog("Introduce radio:"));
- double altura=Double.parseDouble(JOptionPane.showInputDialog("Introduce altura:"));
- JOptionPane.showMessageDialog(null,"Volumen obtenido\n"+String.valueOf(volumen(radio,altura)),"Aviso", JOptionPane.PLAIN_MESSAGE,new ImageIcon("imagen.jpg"));
- System.exit(0);
- }
- catch(Exception ex){
- JOptionPane.showMessageDialog(null,ex.getCause().toString(),"Aviso", JOptionPane.ERROR_MESSAGE,new ImageIcon("imagen.jpg"));
- }
- }
- public static double volumen(double r,double h){
- return (Math.PI*(r*r)*h)/3;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement