Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. package surfaceareacylinder;
  2.  
  3. import java.text.DecimalFormat;
  4. import javax.swing.JOptionPane;
  5.  
  6. public class SurfaceAreaCylinder {
  7.  
  8.     public static void main(String[] args) {
  9.         DecimalFormat threeDigits = new DecimalFormat("0.000");
  10.        
  11.         double radius = Double.parseDouble(JOptionPane.showInputDialog("Please Enter The Radius"));
  12.         double height = Double.parseDouble(JOptionPane.showInputDialog("Please Enter The Height"));
  13.        
  14.         double surfaceArea = (2 * Math.PI * radius * height) + (2 * Math.PI * Math.pow(radius, 2));
  15.        
  16.         JOptionPane.showMessageDialog(null, "The Surface Area Is " + threeDigits.format(surfaceArea));
  17.     }
  18.    
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement