统计信息

  • 访问数:14572
  • 博客数:143
  • 建立时间:2008-01-05
  • 更新时间:2008-10-15
我叫王超然,是一名电脑爱好者,现在在新加坡留学上高一.我立志成为一名电脑人才,愿意在这里与大家一同分享我玩转电脑的心得.O-level华文考了A-One哈哈!

P2Q1

2008-01-21 16:23:19

天气: 晴朗 心情: 高兴

/*P2Q1
 * Name:Wang Chaoran
 * Description:
 */
import java.util.Scanner;
class P2Q1
{
  public static void main(String[] args)
  {
    //Step One: Create a scanner 
    Scanner scan = new Scanner(System.in);
   
    //Step Two: Read in the values of the three edges of the triangle
    System.out.println("Please input the value of first edge of the triangle");
    Double edgeA = scan.nextDouble();
    System.out.println("Please input the value of sencond edge of the triangle");
    Double edgeB = scan.nextDouble();
    System.out.println("Please input hte value of third edge of the triangle");
    Double edgeC = scan.nextDouble();
   
    //Step Three:Make a judgement of the input and output the judgement
    if ((edgeA + edgeB <=edgeC)||(edgeA + edgeC <=edgeB)||(edgeA + edgeB <=edgeC))
    {
      System.out.println("Can edges "+edgeA+", "+edgeB+" and "+edgeC+" form a triangle? false");
    }
  else
  {
          System.out.println("Can edges "+edgeA+", "+edgeB+" and "+edgeC+" form a triangle? true");
  }
  }
 
}

加入收藏 编辑 审核

TAG: computing

我来说两句

OPEN

Powered by X-Space 1.2 © 2001-2006 Comsenz Technology Ltd