2. 然后,编写程序代码,实现收集信息的功能,包括输入、存储和输出等 *** 作。
3. 接着,添加相应的界面,让用户能够清楚地看到输入和输出的信息。
4. 最后,将程序部署到可以访问的服务器上,让用户可以使用小程序收集信息。
public class Test0 {public static void main(String[] args) {
Employee ZhangSan = new Employee("001", "张三", '男', "销售部", 6000, 1000, "普通员工")
Employee LiSi = new Employee("002", "李四", '女', "人事部", 7000, 2000, "超级员工")
System.out.println(ZhangSan.toString())//打印张三信息
System.out.println(LiSi.toString())//打印李四信息
}
}
class Employee{
private String id//员工ID
private String name//姓名
private char sex//性别
private String department //部门
private int basic_salary //基本工资
private int extra_salary //薪金
private String classify //类别
/**
* 构造方法
*/
public Employee(String id, String name, char sex, String department,
int basic_salary, int extra_salary, String classify) {
this.id = id
this.name = name
this.sex = sex
this.department = department
this.basic_salary = basic_salary
this.extra_salary = extra_salary
this.classify = classify
}
public Employee(){
}
public String getId() {
return id
}
public void setId(String id) {
this.id = id
}
public String getName() {
return name
}
public void setName(String name) {
this.name = name
}
public char getSex() {
return sex
}
public void setSex(char sex) {
this.sex = sex
}
public String getDepartment() {
return department
}
public void setDepartment(String department) {
this.department = department
}
public int getBasic_salary() {
return basic_salary
}
public void setBasic_salary(int basic_salary) {
this.basic_salary = basic_salary
}
public int getExtra_salary() {
return extra_salary
}
public void setExtra_salary(int extra_salary) {
this.extra_salary = extra_salary
}
public String getClassify() {
return classify
}
public void setClassify(String classify) {
this.classify = classify
}
public String toString(){
String str ="[员工ID:"+id+"|姓名:"+name+"|性别:"+sex+
"|部门:"+department+"|基本工资:+"+basic_salary+
"|薪金:"+extra_salary+"|类别:"+classify+"]"
return str
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)