展开全部
//以前我也做过..我发给你看看... 一共有6个62616964757a686964616fe78988e69d8331333236396439class文件. 第6为运行程序
// ------------------ 1 -------------------
package 娱乐.教师工资;
public class BaseplisCommissionEmployee extends Employee {
private double jibengzi;
public BaseplisCommissionEmployee()
{
}
public BaseplisCommissionEmployee(double Jibengzi)
{
jibengzi=Jibengzi;
}
public double getJibengzi() {
return jibengzi;
}
public void setJibengzi(double jibengzi) {
this.jibengzi = jibengzi;
}
public String toString3()
{
return "\n基本工资:"+this.jibengzi;
}
}
// ------------------ 2 -------------------
package 娱乐.教师工资;
public class CommissionEmployee extends BaseplisCommissionEmployee {
private double tichenglv;
protected double ticheng;
private double zonge;
public CommissionEmployee()
{
}
public CommissionEmployee(double Zonge,double Tichenglv)
{
tichenglv=Tichenglv;
zonge=Zonge;
}
public double getTicheng() {
return zonge*tichenglv;
}
public double getTichenglv() {
return tichenglv;
}
public void setTichenglv(double tichenglv) {
this.tichenglv = tichenglv;
}
public double getZonge() {
return zonge;
}
public void setZonge(double zonge) {
this.zonge = zonge;
}
public String toString1()
{
return "\n销售总额:"+getZonge()+" 提成率:"+getTichenglv()+" 业务提成金额:"+getTicheng();
}
}
//------------------------3-----------------------
package 娱乐.教师工资;
public class Employee {
protected String xing;
protected String ming;
protected int baoxianhao;
public int getBaoxianhao() {
return baoxianhao;
}
public void setBaoxianhao(int baoxianhao) {
this.baoxianhao = baoxianhao;
}
public String getMing() {
return ming;
}
public void setMing(String ming) {
this.ming = ming;
}
public String getXing() {
return xing;
}
public void setXing(String xing) {
this.xing = xing;
}
public String toString ()
{
return "姓名:"+getXing()+getMing()+" 保险号:"+getBaoxianhao();
}
}
//-------------------------4---------------------------
package 娱乐.教师工资;
public class HourlyEmployee extends CommissionEmployee {
private double xiaoshi;
private double xiaoshixin;
public HourlyEmployee()
{
}
public HourlyEmployee(int Xiaoshi,double Xiaoshixin)
{
xiaoshi=Xiaoshi;
xiaoshixin=Xiaoshixin;
}
public double xiaoshigzi()
{
return xiaoshi*xiaoshixin;
}
public double getXiaoshi() {
return xiaoshi;
}
public void setXiaoshi(double xiaoshi) {
this.xiaoshi = xiaoshi;
}
public double getXiaoshixin() {
return xiaoshixin;
}
public void setXiaoshixin(double xiaoshixin) {
this.xiaoshixin = xiaoshixin;
}
public String toString2()
{
return "\n工作了"+getXiaoshi()+"小时, 每小时时薪:"+getXiaoshixin()+" 总小时薪 :"+xiaoshigzi();
}
}
//------------------------5-------------------------
package 娱乐.教师工资;
public class SalarieEmployee extends HourlyEmployee {
private double zouxin;
protected int zou;
protected double zougzi;
protected int a = 0;
public SalarieEmployee() {
}
public SalarieEmployee(int Zou, double Zougzi) {
zou = Zou;
zougzi = Zougzi;
}
public double zouxin() {
return zou * zougzi;
}
public int getZou() {
return zou;
}
public void setZou(int zou) {
this.zou = zou;
}
public double getZougzi() {
return zougzi;
}
public void setZougzi(double zougzi) {
this.zougzi = zougzi;
}
public double getZouxin() {
return zouxin;
}
public void setZouxin(double zouxin) {
this.zouxin = zouxin;
}
public String toString4() {
return "\n工作了" + getZou() + "周 , 周薪资:" + getZougzi() + " 周薪合计金额:"
+ zouxin();
}
public SalarieEmployee(String Xing, String Ming, int Baoxianhao) {
xing = Xing;
ming = Ming;
baoxianhao = Baoxianhao;
a = 1;
}
public SalarieEmployee(String Xing, String Ming, int Baoxianhao,
double Zonge, double Tichenglv) {
xing = Xing;
ming = Ming;
setZonge(Zonge);
setTichenglv(Tichenglv);
baoxianhao = Baoxianhao;
a = 2;
}
public SalarieEmployee(String Xing, String Ming, int Baoxianhao,
double Zonge, double Tichenglv, double Xiaoshi, double Xiaoshixin) {
xing = Xing;
ming = Ming;
setZonge(Zonge);
setTichenglv(Tichenglv);
baoxianhao = Baoxianhao;
setXiaoshi(Xiaoshi);
setXiaoshixin(Xiaoshixin);
a = 3;
}
public SalarieEmployee(String Xing, String Ming, int Baoxianhao,
double Zonge, double Tichenglv, double Xiaoshi, double Xiaoshixin,
double jibengzi) {
xing = Xing;
ming = Ming;
setZonge(Zonge);
setTichenglv(Tichenglv);
baoxianhao = Baoxianhao;
setXiaoshi(Xiaoshi);
setXiaoshixin(Xiaoshixin);
setJibengzi(jibengzi);
a = 4;
}
public SalarieEmployee(String Xing, String Ming, int Baoxianhao,
double Zonge, double Tichenglv, double Xiaoshi, double Xiaoshixin,
double jibengzi, int zou, double Zougzi) {
xing = Xing;
ming = Ming;
setZonge(Zonge);
setTichenglv(Tichenglv);
baoxianhao = Baoxianhao;
setXiaoshi(Xiaoshi);
setXiaoshixin(Xiaoshixin);
setJibengzi(jibengzi);
setZou(zou);
setZougzi(Zougzi);
a = 5;
}
public String outputString() {
String result = "";
switch (a) {
case 1:
result = toString();
break;
case 2:
result = toString() + toString1();
break;
case 3:
result += toString() + toString1() + toString2();
break;
case 4:
result += toString() + toString1() + toString2() + toString3();
break;
case 5:
result += toString() + toString3() + toString1() + toString2()
+ toString4();
break;
case 6:
result += toString() + toString3();
break;
case 7:
result += toString() + toString3() + toString1();
break;
case 8:
result += toString() + toString3() + toString1() + toString2();
break;
case 9:
result += toString() + toString1();
break;
case 10:
result += toString() + toString2();
break;
case 11:
result += toString() + toString4();
break;
case 12:
result += toString() + toString3() + toString4();
break;
case 13:
result += toString() + toString1() + toString2();
break;
case 14:
result += toString() + toString1() + toString4();
break;
case 15:
result += toString() + toString2() + toString4();
break;
case 16:
result += toString() + toString3() + toString2();
break;
case 17:
result += toString() + toString1() + toString2();
break;
case 18:
result += toString() + toString3() + toString1() + toString4();
break;
case 19:
result += toString() + toString1() + toString2() + toString4();
break;
}
return result;
}
}
//------------------------6---------------------------
package 娱乐.教师工资;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class xiala extends JApplet implements ActionListener, ItemListener {
JComboBox xiala;
JTextField Ming, Xing, Baoqianhao, Zonge, Tichenglv, Xiaoshi, Xiaoshixin,
Jibengzi, Zou, Zougzi;
JLabel Xing1, Ming1, Baoqianhao1, Zonge1, Tichenglv1, Xiaoshi1,
Xiaoshixin1, Jibengzi1, Zou1, Zougzi1;
JTextArea tu;
JButton anniu;
double zonge, tichenglv, xiaoshi, xiaoshixin, jibengzi, zougzi;
String xing, ming;
int zou, baoqianhao;
Container b = this.getContentPane();
public void init() {
b.setLayout(new FlowLayout());
xiala = new JComboBox();
xiala.addItem("选择工种");
xiala.addItem("带薪职工");
xiala.addItem("带薪拿提成职工");
xiala.addItem("小时工");
xiala.addItem("周职工");
b.add(xiala);
Xing1 = new JLabel("姓");
Xing = new JTextField(10);
b.add(Xing1);
b.add(Xing);
Ming1 = new JLabel("名");
Ming = new JTextField(10);
b.add(Ming1);
b.add(Ming);
Baoqianhao1 = new JLabel("标签号");
Baoqianhao = new JTextField(10);
b.add(Baoqianhao1);
b.add(Baoqianhao);
Jibengzi1 = new JLabel("基本工资");
Jibengzi = new JTextField(10);
b.add(Jibengzi1);
b.add(Jibengzi);
Zonge1 = new JLabel("业绩总额");
Zonge = new JTextField(10);
b.add(Zonge1);
b.add(Zonge);
Tichenglv1 = new JLabel("业务提成率");
Tichenglv = new JTextField(10);
b.add(Tichenglv1);
b.add(Tichenglv);
Xiaoshi1 = new JLabel("工作小时");
Xiaoshi = new JTextField(10);
b.add(Xiaoshi1);
b.add(Xiaoshi);
Xiaoshixin1 = new JLabel("每小时的薪水");
Xiaoshixin = new JTextField(10);
b.add(Xiaoshixin1);
b.add(Xiaoshixin);
Zou1 = new JLabel("工作多少周");
Zou = new JTextField(10);
b.add(Zou1);
b.add(Zou);
Zougzi1 = new JLabel("每周的工资");
Zougzi = new JTextField(10);
b.add(Zougzi1);
b.add(Zougzi);
anniu = new JButton("确定");
b.add(anniu);
tu = new JTextArea();
b.add(tu);
tu.setText("");
anniu.addActionListener(this);
xiala.addItemListener(this);
Xing.setEditable(false);
Ming.setEditable(false);
Baoqianhao.setEditable(false);
Jibengzi.setEditable(false);
Zonge.setEditable(false);
Tichenglv.setEditable(false);
Xiaoshi.setEditable(false);
Xiaoshixin.setEditable(false);
Zou.setEditable(false);
Zougzi.setEditable(false);
}
public void itemStateChanged(ItemEvent event) {
Xing.setEditable(false);
Ming.setEditable(false);
Baoqianhao.setEditable(false);
Jibengzi.setEditable(false);
Zonge.setEditable(false);
Tichenglv.setEditable(false);
Xiaoshi.setEditable(false);
Xiaoshixin.setEditable(false);
Zou.setEditable(false);
Zougzi.setEditable(false);
Jibengzi.setText("");
Zonge.setText("");
Tichenglv.setText("");
Xiaoshi.setText("");
Xiaoshixin.setText("");
Zou.setText("");
Zougzi.setText("");
if (event.getStateChange() == ItemEvent.SELECTED) {
if (xiala.getSelectedItem().equals("带薪职工")) {
//System.out.println("12321");
Xing.setEditable(true);
Ming.setEditable(true);
Baoqianhao.setEditable(true);
Jibengzi.setEditable(true);
}
if (xiala.getSelectedItem().equals("带薪拿提成职工")) {
Xing.setEditable(true);
Ming.setEditable(true);
Baoqianhao.setEditable(true);
Jibengzi.setEditable(true);
Zonge.setEditable(true);
Tichenglv.setEditable(true);
}
if (xiala.getSelectedItem().equals("小时工")) {
Xing.setEditable(true);
Ming.setEditable(true);
Baoqianhao.setEditable(true);
Xiaoshi.setEditable(true);
Xiaoshixin.setEditable(true);
}
if (xiala.getSelectedItem().equals("周职工")) {
Xing.setEditable(true);
Ming.setEditable(true);
Baoqianhao.setEditable(true);
Zou.setEditable(true);
Zougzi.setEditable(true);
}
}
}
public void actionPerformed(ActionEvent event) {
xing = Xing.getText() == null || Xing.getText().equals("") ? "0" : Xing
.getText();
ming = Ming.getText() == null || Ming.getText().equals("") ? "0" : Ming
.getText();
baoqianhao = Integer
.parseInt(Baoqianhao.getText() == null
|| Baoqianhao.getText().equals("") ? "0" : Baoqianhao
.getText());
zou = Integer.parseInt(Zou.getText() == null
|| Zou.getText().equals("") ? "0" : Zou.getText());
zonge = Double.parseDouble(Zonge.getText() == null
|| Zonge.getText().equals("") ? "0" : Zonge.getText());
tichenglv = Double.parseDouble(Tichenglv.getText() == null
|| Tichenglv.getText().equals("") ? "0" : Tichenglv.getText());
xiaoshi = Double.parseDouble(Xiaoshi.getText() == null
|| Xiaoshi.getText().equals("") ? "0" : Xiaoshi.getText());
xiaoshixin = Double
.parseDouble(Xiaoshixin.getText() == null
|| Xiaoshixin.getText().equals("") ? "0" : Xiaoshixin
.getText());
jibengzi = Double.parseDouble(Jibengzi.getText() == null
|| Jibengzi.getText().equals("") ? "0" : Jibengzi.getText());
zougzi = Double.parseDouble(Zougzi.getText() == null
|| Zougzi.getText().equals("") ? "0" : Zougzi.getText());
// xing=Xing.getText();
// ming=Ming.getText();
// baoqianhao=Integer.parseInt(Baoqianhao.getText());
// zou=Integer.parseInt(Zou.getText());
// zonge=Double.parseDouble(Zonge.getText());
// tichenglv=Double.parseDouble(Tichenglv.getText());
// xiaoshi=Double.parseDouble(Xiaoshi.getText());
// xiaoshixin=Double.parseDouble(Xiaoshixin.getText());
// jibengzi=Double.parseDouble(Jibengzi.getText());
// zougzi=Double.parseDouble(Zougzi.getText());
// System.out.print(xing+"\n"+ming+"\n"+baoqianhao+"\n"+jibengzi+"\n"+zou+zonge+"\n"+tichenglv+"\n"+xiaoshi+"\n"+xiaoshixin+"\n"+zougzi);
if (ming == "0" || ming.equals("") || xing == "0" || xing.equals("")
|| Baoqianhao.getText() == "0"
|| Baoqianhao.getText().equals("")) {
tu.setText("请输入正确的用户名或编号 ");
return;
} else {
SalarieEmployee aa = new SalarieEmployee(xing, ming, baoqianhao);
tu.setText(aa.outputString());
}
if (Jibengzi.getText() == null || Jibengzi.getText().equals("")) {
} else {
SalarieEmployee aa = new SalarieEmployee(xing, ming, baoqianhao);
aa.setJibengzi(jibengzi);
aa.a = 6;
tu.setText(aa.outputString());
}
if (Xiaoshi.getText() == null || Xiaoshi.getText().equals("")
|| Xiaoshixin.getText() == null
|| Xiaoshixin.getText().equals("")) {
} else {
SalarieEmployee aa = new SalarieEmployee(xing, ming, baoqianhao);
aa.setXiaoshi(xiaoshi);
aa.setXiaoshixin(xiaoshixin);
aa.a = 10;
tu.setText(aa.outputString());
}
if (Zou.getText() == null || Zou.getText().equals("")
|| Zougzi.getText() == null || Zougzi.getText().equals("")) {
} else {
SalarieEmployee aa = new SalarieEmployee(xing, ming, baoqianhao);
aa.setZou(zou);
aa.setZougzi(zougzi);
aa.a = 11;
tu.setText(aa.outputString());
}
if (Jibengzi.getText() == null || Jibengzi.getText().equals("")
|| Zonge.getText() == null || Zonge.getText().equals("")
|| Tichenglv.getText() == null
|| Tichenglv.getText().equals("")) {
} else {
SalarieEmployee aa = new SalarieEmployee(xing, ming, baoqianhao);
aa.setJibengzi(jibengzi);
aa.setZonge(zonge);
aa.setTichenglv(tichenglv);
aa.a = 7;
tu.setText(aa.outputString());
}
}
}
已赞过
已踩过<
你对这个回答的评价是?
评论
收起