Jiangjin.class
package beanjiangjin;
public class Jiangjin
{
double profits=0,bonus=-1;
public void setProfits(double a)
{
profits=a;
}
public double getProfits()
{
return profits;
}
public double getBonus()
{ double commission1=10/100,
commission2=75/1000,
commission3=5/100,
commission4=3/100,
commission5=15/1000,
commission6=1/100;
if(profits<=10)
bonus=profits*commission1;
else if(profits>10&&profits<=20)
bonus=(profits-10)*commission2+10*commission1;
else if(profits>20&&profits<=40)
bonus=(profits-20)*commission3+10*commission1+10*commission2;
else if(profits>40&&profits<=60)
bonus=(profits-40)*commission4+10*commission1+10*commission2+20*commission3;
else if(profits>60&&profits<=100)
bonus=(profits-60)*commission5+10*commission1+10*commission2+20*commission3+20*commission4;
else if(profits>100)
bonus=(profits-100)*commission6+10*commission1+10*commission2+20*commission3+20*commission4+40*commission5;
return bonus;
}
}
A1.jsp
<%@ page contentType="text/html;charset=utf-8"%>
<jsp:useBean id ="bon" class="beanjiangjin.Jiangjin"scope="request"/>
<html><body bgcolor =pink><font size=3>
<form action=""method="post">
输入企业利润:
<input type =text name ="profits" value=0 size=5>
<input type =submit value="提交">
</form>
<jsp:setProperty name="bon"property="*"/>
奖金数额<jsp:getProperty name="bon"property="bonus"/>
<br><jsp:getProperty name="bon"property="profits"/>
</font></body></html>
这是运行效果
为什么bonus的值传不到呢?
求解,谢谢了.
相关分类