Climbing的专栏

Life is limited, but art is long

huang ClimbingID:hpdlzu80100
[修改头像]
1569次访问,排名2万外好友5人,关注者6
热爱生活,积极向上,流自己的汗,吃自己的饭!
hpdlzu80100的文章
原创 23 篇
翻译 0 篇
转载 2 篇
评论 0 篇
最近评论
软件项目交易
订阅我的博客
XML聚合  FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
订阅到BlogLines
订阅到Yahoo
订阅到GouGou
订阅到飞鸽
订阅到Rojo
订阅到newsgator
订阅到netvibes
文章分类
收藏
    相册
    存档

    原创 三角形构成判定(Judge whether 3 side lengths can form a triangle)

    新一篇: 数组排序的Java实现(Sorting of arrays implemented with Java)

    //Judge whether 3 side lengths can be used to form a triangle
    import javax.swing.*;
    public class ISTriangle {
        
    public static void main(String args[])
        
    {
            
    double l1,l2,l3;
            String L1,L2,L3;
            
    boolean guard;
            L1
    =JOptionPane.showInputDialog("Enter the first side length:");
            L2
    =JOptionPane.showInputDialog("Enter the second side length:");
            L3
    =JOptionPane.showInputDialog("Enter the third side length:");
            
            l1
    =Double.parseDouble(L1);
            l2
    =Double.parseDouble(L2);
            l3
    =Double.parseDouble(L3);
            
            guard
    =(l1+l2>l3&&l1+l3>l2&&l2+l3>l1);
            
            
    if (guard)
                JOptionPane.showMessageDialog(
    null"A triangle can be formed by" +
                        
    " the three lengths","Triangle Judgement",JOptionPane.INFORMATION_MESSAGE);
            
    else
                JOptionPane.showMessageDialog(
    null"A triangle can not be formed by" +
                        
    " the three lengths.","Triangle Judgement",JOptionPane.ERROR_MESSAGE);
            
            
        }


    }

     

    发表于 @ 2008年04月07日 17:27:00|评论(loading...)|编辑

    评论:没有评论。

    发表评论  


    登录
    Csdn Blog version 3.1a
    Copyright © Climbing