简单的五险⼀⾦计算器
对于刚⼊门的学习javaweb的同学,这是⼀个很简单的例⼦,
下⾯是查询界⾯(选择不同的城市进⾏查询):
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "/TR/html4/loose.dtd"> <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>五险⼀⾦查询</title>
</head>
<body>
<div>
<form action="cityResult.jsp" method="post">
<table align="center">
<tr>
<td>
<h1>五险⼀⾦及税后计算器</h1>
</td>
</tr>
<tr>
<td >税前:
<input type="text" id="shuiqian" name="tax" />
<select name="select">
<option value="上海" selected="selected">上海</option>
<option value="南京">南京</option>
<option value="杭州">杭州</option>
<option value="宁波">宁波</option>
<option value="济南">济南</option>
<option value="苏州">苏州</option>
<option value="福州">福州</option>
<option value="厦门">厦门</option>
<option value="合肥">合肥</option>
<option value="青岛">青岛</option>
<option value="北京">北京</option>
<option value="天津">天津</option>
<option value="太原">太原</option>
<option value="呼和浩特">呼和浩特</option>
<option value="⽯家庄">⽯家庄</option>
<option value="武昌">武昌</option>
<option value="长沙">长沙</option>
<option value="南昌">南昌</option>
<option value="郑州">郑州</option>
<option value="⼴州">⼴州</option>山西十大景区
<option value="深圳">深圳</option>
<option value="南宁">南宁</option>
<option value="海⼝">海⼝</option>
<option value="珠海">珠海</option>
<option value="佛⼭">佛⼭</option>
<option value="东莞">东莞</option>
<option value="沈阳">沈阳</option>
<option value="沈阳">沈阳</option>
<option value="⼤连">⼤连</option>
<option value="长春">长春</option>
<option value="哈尔滨">哈尔滨</option>
<option value="西安">西安</option>
<option value="银川">银川</option>
<option value="兰州 ">兰州</option>
<option value="西宁">西宁</option>
<option value="乌鲁⽊齐">乌鲁⽊齐</option>
<option value="成都">成都</option>
<option value="重庆">重庆</option>
<option value="昆明">昆明</option>
<option value="贵阳">贵阳</option>
</select>
</td>
</tr>
<tr>
<td >税后: <input
type="text" id="shuihou"
readonly="readonly" />
</td>
</tr>
<tr>
<td align="center"><input type="submit"
value="提交" /></td>
</tr>
</table>
</form>
</div>
</body>
</html>
这个是查询的结果显⽰页⾯:
<%@page import="entity.Sal"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "/TR/html4/loose.dtd"> <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%=new Parameter("select").getBytes("ISO-8859-1"),"UTF-8")%></title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String city = Parameter("select");
String ci= new Bytes("ISO-8859-1"),"UTF-8");
String Parameter("tax");
float mon=Float.parseFloat(money);
//System.out.println(city);
float a=0,b=0,c=0,d=0;
for(Sal s:Sal.sal){
CityName().equals(ci)){
a = Live();
b=Medical();
c=Old();
d=Work();
}
}
%>
<div>
<h1><%=ci%>税后的⼯资为:
漂的多音字组词
</h1>
<br />
<table>
<tr>
<td>五⾦⼀险汇缴明细:
</td>
</tr>
<tr>
<td>个⼈应缴部分:</td>
</tr>
<tr>
<td>养⽼保险⾦:<%=c %></td>
</tr>
<tr>
<td>医疗保险⾦:<%=b %></td>
</tr>
<tr>
<td>失业保险⾦:<%=d %></td>五险一金查询
</tr>
<tr>
<td>基本住房公积⾦:<%=a %></td>
</tr>
<tr>
<td>补充住房公积⾦:<%=0 %></td>
</tr>
<tr>
<td>⼯伤保险⾦:</td>
</tr>
<tr>
<td>⽣育保险⾦:</td>
</tr>
<tr>
<td>共计⽀出:<%=a+b+c+d %></td>
</tr>
<tr>
<td>扣除四⾦后的⽉薪:<%=mon-a-b-c-d %></td>            </tr>
<%
float t=0;
float left=mon-a-b-c-d-3500;
if(left<=1500){
t=left*0.03f;
}else if(left>1500&&left<4500){
t=left*0.1f-105;
}else if(left>4500&&left<9000){
t=left*0.2f-555;
}else if(left>9000&&left<35000){
t=left*0.25f-1005;
}else if(left>35000&&left<55000){
t=left*0.30f-2755;
}else if(left>55000&&left<80000){
t=left*0.35f-5505;
}else{
t=left*0.45f-13505;
}
%>
<tr>
<td>个⼈所得税:<%=t %></td>
</tr>
<tr>
<td>税后⽉薪:<%=mon-a-b-c-d-t %></td>            </tr>
</table>
</div>
</body>
</html>
下⾯的是各个城市信息的实体类:
package entity;
public class Sal {
private String cityName;
private float medical;
private float old;
private float work;
private float live;
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public float getMedical() {
return medical;
}
public void setMedical(float medical) {
}
public float getOld() {
return old;
}
public void setOld(float old) {
this.old = old;
}
public float getWork() {
return work;
}
public void setWork(float work) {
this.work = work;
}
public float getLive() {
return live;
}
public void setLive(float live) {
this.live = live;
}
public Sal(){
}
public Sal(String cityName, float medical, float old, float work, float live) {
super();
this.cityName = cityName;
this.old = old;
this.work = work;
this.live = live;
}
public static Sal[] sal = new Sal[] { new Sal("上海", 0.08f, 0.02f, 0.01f, 0.07f),        new Sal("南京", 0.08f, 0.02f, 0.01f, 0.08f),
new Sal("杭州", 0.08f, 0.02f, 0.01f, 0.1f),
new Sal("宁波", 0.08f, 0.02f, 0.005f, 0.08f),
new Sal("济南", 0.08f, 0.02f, 0.003f, 0.07f),
new Sal("苏州", 0.08f, 0.02f, 0.005f, 0.08f),
new Sal("福州", 0.08f, 0.02f, 0.005f, 0.12f),张力尹整容
new Sal("厦门", 0.08f, 0.02f, 0.005f, 0.12f),
new Sal("合肥", 0.08f, 0.02f, 0.01f, 0.12f),
new Sal("青岛", 0.08f, 0.02f, 0.01f, 0.1f),
new Sal("北京", 0.08f, 0.02f, 0.002f, 0.12f),
new Sal("天津", 0.08f, 0.02f, 0.01f, 0.11f),
new Sal("太原", 0.08f, 0.02f, 0.01f, 0.06f),
new Sal("呼和浩特", 0.08f, 0.02f, 0.01f, 0.1f),
new Sal("⽯家庄", 0.08f, 0.02f, 0.01f, 0.07f),山东高考时间表安排2022
new Sal("武汉", 0.08f, 0.02f, 0.002f, 0.05f),
new Sal("长沙", 0.08f, 0.02f, 0.01f, 0.06f),
new Sal("南昌", 0.08f, 0.02f, 0.01f, 0.08f),
new Sal("郑州", 0.08f, 0.02f, 0.003f, 0.1f),
new Sal("⼴州 ", 0.08f, 0.02f, 0.002f, 0.05f),
new Sal("深圳", 0.08f, 0.02f, 0.002f, 0.05f),
new Sal("南宁", 0.08f, 0.02f, 0.005f, 0.12f),
new Sal("海⼝", 0.08f, 0.02f, 0.005f, 0.1f),
new Sal("珠海", 0.08f, 0.02f, 0.002f, 0.05f),
new Sal("佛⼭", 0.08f, 0.02f, 0.002f, 0.05f),
new Sal("东莞", 0.08f, 0.02f, 0.002f, 0.05f),
new Sal("沈阳", 0.08f, 0.02f, 0.01f, 0.12f),
new Sal("⼤连", 0.08f, 0.02f, 0.01f, 0.1f),lol魔幻卡牌
new Sal("长春", 0.08f, 0.02f, 0.003f, 0.07f),
new Sal("哈尔滨", 0.08f, 0.02f, 0.005f, 0.08f),
new Sal("西安", 0.08f, 0.02f, 0.003f, 0.15f),