Java 员工信息管理系统:Staff 类实现与方法定义
public class Staff { private String empNo; private String password; private String empName; private String gender; private String idCardNo; private int age; private int seniority; private double wages; private String title; private String department; private String phoneNum; private String homeAddress;
// 构造方法
public Staff(String empNo, String password, String empName, String gender, String idCardNo,
int age, int seniority, double wages, String title, String department, String phoneNum, String homeAddress) {
this.empNo = empNo;
this.password = password;
this.empName = empName;
this.gender = gender;
this.idCardNo = idCardNo;
this.age = age;
this.seniority = seniority;
this.wages = wages;
this.title = title;
this.department = department;
this.phoneNum = phoneNum;
this.homeAddress = homeAddress;
}
// 登录系统方法
public boolean login(String empNo, String password) {
if (empNo.equals(this.empNo) && password.equals(this.password)) {
return true;
}
return false;
}
// 查看个人信息方法
public void showDetail() {
System.out.println('工号:' + empNo);
System.out.println('姓名:' + empName);
System.out.println('性别:' + gender);
System.out.println('身份证号:' + idCardNo);
System.out.println('年龄:' + age);
System.out.println('工龄:' + seniority);
System.out.println('工资:' + wages);
System.out.println('职称:' + title);
System.out.println('所属部门:' + department);
System.out.println('联系方式:' + phoneNum);
System.out.println('家庭住址:' + homeAddress);
}
// 修改个人信息方法
public void alterDetail(String empName, String gender, String idCardNo,
int age, int seniority, double wages, String title, String department, String phoneNum, String homeAddress) {
this.empName = empName;
this.gender = gender;
this.idCardNo = idCardNo;
this.age = age;
this.seniority = seniority;
this.wages = wages;
this.title = title;
this.department = department;
this.phoneNum = phoneNum;
this.homeAddress = homeAddress;
}
}
原文地址: https://www.cveoy.top/t/topic/orvG 著作权归作者所有。请勿转载和采集!