回复 2楼 yehuanfeng
这个是我的代码,但不是定义类来实现的,希望可以给指导指导!嘻嘻!
float pay = Convert.ToSingle(textpay.Text);
float time = Convert.ToSingle(textime.Text);
float ripay = Convert.ToSingle(texripan.Text);
string name = Convert.ToString(texname.Text);
if (comboBox1.Text == "老板")
{
score = ripay * time + pay;
MessageBox.Show("您好," + name + "老板,\n您的工资为" + score + "元!!!");
}
else if (comboBox1.Text == "销售员")
{
score = ripay * time + pay * 0.2;
MessageBox.Show("你好," + name + "销售员,\n您的工资为" + score + "元!!!");
}
else if (comboBox1.Text == "计件工")
{
score = pay * time;
MessageBox.Show("你好," + name + "计件工,\n您的工资为" + score + "元!!!");
}
else if (comboBox1.Text == "小时工")
{
score = pay * time + 8 * time;
MessageBox.Show("你好," + name + "小时工,\n您的工资为" + score + "元!!!");
}
else
MessageBox.Show("对不起,你的输入有误!!!!\n没有你所选择的职务!!!\n请重新选择!!!");
}