html+jsp 落叶松毛虫黑龙江幼虫发生数量与气候因子的关系确定:发生量=0.014*8月降水量+0.168月相对湿度-0.159*1月极高温度-0.145*1月极低温度-0.271*8月极低温度-0.899*7月平均温度+4.544,编写一个JavaBean实现落叶松毛虫发生量预测的程序,并通过jsp进行调用

songmaochong.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>松毛虫</title>
</head>
<body>
<form action="songmaochong.jsp" method="post">
8月降水量<input type="text" name="eignt_water"><br>
8月相对湿度<input type="text" name="eight_shi"><br>
1月极高温度<input type="text" name="jan_high_temp"><br>
1月极地温度<input type="text" name="jan_low_temp"><br>
8月极地温度<input type="text" name="eight_low_temp"><br>
7月平均温度<input type="text" name="july_ave"><br>
<input type="submit" value="提交">
<input type="reset" value="重置">
</form>
</body>
</html>
songmaochong.jsp
<%@ page language="java" contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>落叶松毛虫</title>
</head>

<body>
<jsp:useBean id="simple" scope="page" class="bean.songmaochong"/>
<jsp:setProperty name="simple" property="*"/>
落叶松毛虫的数量为:<%=simple.count()%>

</body>
</html>
songmaochong.java
package bean;

public class songmaochong{

        private double eight_water,eight_shi,jan_high_temp,jan_low_temp,eight_low_temp,july_ave;
        private double result;
    public void setEight_water(double eight_water)
    {this.eight_water=eight_water;}

    public void setEight_shi(double eight_shi)
    {this.eight_shi=eight_shi;}

    public void setJan_high_temp(double jan_high_temp)
    {this.jan_high_temp=jan_high_temp;}

    public void setJan_low_tmep(double jan_low_temp)
    {this.jan_low_temp=jan_low_temp;}

    public void setEight_low_temp(double eight_low_temp)
    {this.eight_low_temp=eight_low_temp;}

    public void setJuly_ave(double july_ave)
    {this.july_ave=july_ave;}
    public double count()
    {
        result=0.014*eight_water+0.16*eight_shi-0.159*jan_high_temp-0.145*jan_low_temp-0.271*eight_low_temp-0.899*july_ave+4.544;
                return result;
         }
}

效果:

0

Leave a Reply

Your email address will not be published.