import java.awt.*;
import java.awt.event.*;
import java.lang.Double;
public class Six_4{
static TextField tf1=new TextField("",35);
static TextField tf2=new TextField("",35);
static Frame f=new Frame("Tax");
static Label l1=new Label("工资额:");
static Label l2=new Label("所得税:");
public static void main(String args[]){
f.setLayout(new FlowLayout());
f.add(l1);
f.add(tf1);
f.add(l2);
f.add(tf2);
tf1.addActionListener(new Ac());
f.setSize(300,300);
f.setVisible(true);
}
static class Ac implements ActionListener{
public void actionPerformed(ActionEvent e)
{
int sal=tf1.getColumns();
double tax,taxsal;
taxsal=sal-800;
if(taxsal<=0)
{
tax=0.00;
}
else if((taxsal-500.00)<=0)
{
tax=taxsal*0.05;
}
else if((taxsal-500.00)>0&&(taxsal-2000.00)<=0)
{
tax=500*0.05+(taxsal-500.00)*0.10;
}
else if((taxsal-2000.00)>0&&(taxsal-5000.00)<=0)
{
tax=500.00*0.05+1500.00*0.10+(taxsal-2000.00)*0.15;
}
else if((taxsal-5000.00)>0&&(taxsal-20000.00)<=0)
{
tax=500.00*0.05+1500.00*0.10+3000.00*0.15+(taxsal-5000.00)*0.20;
}
else if((taxsal-20000.00)>0&&(taxsal-40000.00)<=0)
{
tax=500.00*0.05+1500.00*0.10+3000.00*0.15+15000.00*0.20+(taxsal-20000.00)*0.25;
}
else if((taxsal-40000.00)>0&&(taxsal-60000.00)<=0)
{
tax=500.00*0.05+1500.00*0.10+3000.00*0.15+15000.00*0.20+20000.00*0.25+(taxsal-40000.00)*0.30;
}
else if((taxsal-60000.00)>0&&(taxsal-80000.00)<=0)
{
tax=500.00*0.05+1500.00*0.10+3000.00*0.15+15000.00*0.20+20000.00*0.25+20000.00*0.30+(taxsal-60000.00)*0.35;
}
else if((taxsal-80000.00)>0&&(taxsal-100000.00)<=0)
{
tax=500.00*0.05+1500.00*0.10+3000.00*0.15+15000.00*0.20+20000.00*0.25+20000.00*0.30+20000.00*0.35+(taxsal-80000.00)*0.40;
}
else
tax=500.00*0.05+1500.00*0.10+3000.00*0.15+15000.00*0.20+20000.00*0.25+20000.00*0.30+20000.00*0.35+20000.00*0.40+(taxsal-100000.00)*0.45;
String s=Double.toString(tax);
tf2.setText(s);
}
}
}