Friday, August 16, 2013

Exercise No. 19

 import javax.swing.JOptionPane;
import java.text.DecimalFormat;

public class Exercise19{
  
    public static void main(String[]args)
    {
        double h=0;
        double v=0;
        double c=0;
        double t;
     
     
        int boss=Integer.parseInt(JOptionPane.showInputDialog(null,"Enter the Volume of cylinder"));
        int boss1=Integer.parseInt(JOptionPane.showInputDialog(null,"Enter the Radius of cylinder"));
     
        double j = Math.pow(boss1, 2);
  
        h=boss/3.16*j;
       
        c=2*3.16 * j*(j+h);
       
        DecimalFormat fomat = new DecimalFormat("###.##");
       
        JOptionPane.showMessageDialog(null,"Height :  " + fomat.format(h) + "\nCost :  " + c);
     
     
  
     
     
     
     
    }

}

No comments:

Post a Comment