我是靠谱客的博主 怕孤独枕头,这篇文章主要介绍计算一个圆柱体的体积,现在分享给大家,希望可以做个参考。

import javax.swing.JOptionPane;
public class ComputeVolume {
    public static void main(String[] args){
        final double PI = 3.14;
        double volume;
        String inputRadius = JOptionPane.showInputDialog(null,"plz enter a radius:",
                "Input Dialog Demo",JOptionPane.QUESTION_MESSAGE);
        String inputHeight = JOptionPane.showInputDialog(null,"plz enter a height:",
                "Input Dialog Demo",JOptionPane.QUESTION_MESSAGE);
        double radius = Double.parseDouble(inputRadius);
        double height = Double.parseDouble(inputHeight);
        volume = (int)(radius * radius * PI * height);
        JOptionPane.showMessageDialog(null, "the Volume is :" + volume);
    }
}

 

转载于:https://www.cnblogs.com/Amoxicil/p/3888235.html

最后

以上就是怕孤独枕头最近收集整理的关于计算一个圆柱体的体积的全部内容,更多相关计算一个圆柱体内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(69)

评论列表共有 0 条评论

立即
投稿
返回
顶部