三角形构成判定(Judge whether 3 side lengths can form a triangle)
2008-04-07 17:27
246 查看
//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);
}
}
相关文章推荐
- CF 6A Triangle (判断能否构成三角形)
- 输入三个数自动判定是否能构成三角形
- 问题三十四: 任意输入三条边(a,b,c实型),若能构成三角形,则计算并输出其面积,否则输出标志“No Triangle!”。
- ”A page can have only one server-side Form tag“错误
- 任意输入三条边(a,b,c实型),若能构成三角形,则计算并输出其面积,否则输出标志“No Triangle!”。
- JAVA之1.封装一类三角形对象Triangle,该类对象具有三条边的属性,具有初始化三角形的功能、修改边长的功能、判断三条边能否构成三角形的功能、求周长的功能、求面积的功能。
- C++上机报告,任意输入三条边(a,b,c实型),若能构成三角形,则计算并输出其面积,否则输出标No Triangle!
- POJ 2079 Triangle(凸包,最大三角形)
- Firefox can not launch Oracle EBS Form
- 三角形类别的判定
- openGl学习之判定点在三角形的内部还是外部
- Triangle三角形的最小路径和
- hdu 4466 triangle 三角形统计 数学计数
- 判断输入三边能否构成三角形
- 1. FrogRiverOne 一苇渡江 Find the earliest time when a frog can jump to the other side of a river.
- 趣题:用正三角形和正四边形构成凸多边形
- 打印一个正(等边)三角形(假设相同数量的星号构成的边长相等)
- Leetcode-120_Triangle(三角形)—动态规划解法+记忆化搜索解法-【C++】
- 习题2-3 倒三角形(triangle)
- Switch view in the InfoPath form according to the whether current user is in SharePoint group admin