zoukankan      html  css  js  c++  java
  • java实现土地测量

    ** 土地测量**

    造成高房价的原因有许多,比如土地出让价格。既然地价高,土地的面积必须仔细计算。遗憾的是,有些地块的形状不规则,比如是如图【1.jpg】中所示的五边形。
    一般需要把它划分为多个三角形来计算。
    已知三边求三角形的面积需要用海伦定理,参见【2.jpg】
    各条边长数据如下:
    AB = 52.1
    BC = 57.2
    CD = 43.5
    DE = 51.9
    EA = 33.4
    EB = 68.2
    EC = 71.9
    根据这些数据求五边形地块的面积。四舍五入到小数后两位。只写结果,不要源代码!

    答案写在“解答.txt”中,不要写在这里!

    参考答案:
    3789.86

    public class Main {
        
        public double getResult(double a, double b, double c) {
            double p = (a + b + c) / 2;
            double result = Math.sqrt(p * (p - a) * (p - b) * (p - c));
            return result;
        }
        
        public static void main(String[] args) {
            Main test = new Main();
            double result = test.getResult(52.1, 33.4, 68.2);
            result += test.getResult(68.2, 57.2, 71.9);
            result += test.getResult(71.9, 51.9, 43.5);
            System.out.println(result);
        }
    

    }

  • 相关阅读:
    hadoop yarn日志分离
    hadoop优化
    hive UDF
    hadoophttpfs
    spark编译
    spark feature
    python
    python 装饰器
    HTML特殊转义字符列表
    博客园数据统计
  • 原文地址:https://www.cnblogs.com/a1439775520/p/13077063.html
Copyright © 2011-2022 走看看