来了啊,你这个没讲清楚,能说的清楚一点吗?public class Teacher {
public static void main(String[] args) {
Introduce introduce = new Introduce();
Teacher teacher = new Teacher();
String name = "王芳芳";
int age = 18;
String post = "讲师";
double salary = 0;
if (post == "教授"){
salary = introduce. professo();
}else if (post == "副教授"){
salary = introduce.assprofessor();
}else if (post == "讲师"){
salary = introduce.teacher();
}
teacher.Teacher(name,age,post,salary);
}
void Teacher(String name,int age,String post,double salary){
System.out.println("名字是"+name);
System.out.println("年龄是"+age);
System.out.println("职业是"+post);
System.out.println("工资有"+salary);
}
}
class Introduce {
double professo(){
return 1.3;
}
double assprofessor(){
return 1.2;
}
double teacher() {
return 1.1;
}
}
亲,这是不是你想要的呢?如果是请设置最佳答案啊!谢谢啦。 |