JAVA 编写Employee类,该类包含:
(1)4个受保护属性。分别是雇员的姓名name、工号number、住址address和薪水salary。(2)1个构造器方法。用于初始化name、number和salar...
(1) 4个受保护属性。分别是雇员的姓名name、工号number、住址address和薪水salary。
(2) 1个构造器方法。用于初始化name、number和salary属性。
(3) salary 与address属性的set和get方法。
(4) 1个公有成员方法。实现职员基本信息的输出。 展开
(2) 1个构造器方法。用于初始化name、number和salary属性。
(3) salary 与address属性的set和get方法。
(4) 1个公有成员方法。实现职员基本信息的输出。 展开
3个回答
展开全部
public class Employee {
private String name=null;
prvate String number=null;
private String address=null
private int salary ;
public void employee(String name,String number,int salary) {
this.name = name;
this.number = number;
this.salary = salary;
}
public void setSalary(int salary) {
this.salary = salary;
}
public int getSalary() {
return this.salary;
}
public void setAddress(String address) {
this.address = address;
}
public int getAddress() {
return this.address;
}
public void employeeInfromation() {
System.out.println(""+this.name);
System.out.println(""+this.number);
System.out.println(""+this.salary);
System.out.println(""+this.address);
}
}
我好无聊啊、在公司加班给你写这个。。。。
private String name=null;
prvate String number=null;
private String address=null
private int salary ;
public void employee(String name,String number,int salary) {
this.name = name;
this.number = number;
this.salary = salary;
}
public void setSalary(int salary) {
this.salary = salary;
}
public int getSalary() {
return this.salary;
}
public void setAddress(String address) {
this.address = address;
}
public int getAddress() {
return this.address;
}
public void employeeInfromation() {
System.out.println(""+this.name);
System.out.println(""+this.number);
System.out.println(""+this.salary);
System.out.println(""+this.address);
}
}
我好无聊啊、在公司加班给你写这个。。。。
展开全部
public class Employee{
protected String name;
protected String number;
protected String address;
protected String salary;
public Employee(String name,String number,String salary){
this.name=name;
this.number=number;
this.salary=salary;
}
public void setSalary(String salary){
this.salary=salary;
}
public String getSalary(){
return salary;
}
public void setAddress(String address){
this.address=address;
}
public String getAddress(){
return address;
}
public void toString(){
printf("name:"+name+"number:"+number+"address:"+address+"salary:"+salary);
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
? 你想干嘛? 想问什么?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询