Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package surfaceareacylinder;
- import java.text.DecimalFormat;
- import javax.swing.JOptionPane;
- public class SurfaceAreaCylinder {
- public static void main(String[] args) {
- DecimalFormat threeDigits = new DecimalFormat("0.000");
- double radius = Double.parseDouble(JOptionPane.showInputDialog("Please Enter The Radius"));
- double height = Double.parseDouble(JOptionPane.showInputDialog("Please Enter The Height"));
- double surfaceArea = (2 * Math.PI * radius * height) + (2 * Math.PI * Math.pow(radius, 2));
- JOptionPane.showMessageDialog(null, "The Surface Area Is " + threeDigits.format(surfaceArea));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement