【问题描述】请根据已知的程序代码,补全类Worker,显示工人和安全帽的信息。
【输入形式】无
【输出形式】
Name=zhang
Age=55
Salary=2874.0
Level=3
Helmet=1001,white,2016-12-12
public class Test{
public static void main(String [] args){
Helmet h = new Helmet("1001","white","2016-12-12");
Worker w = new Worker("zhang", 55, 2874,3,h);
w.display();
}
}
class Worker {
private String name;
private int age;
private double salary;
private int level;
private Helmet myHelmet;
public Worker(String name,int age,double salary,int level,Helmet myHelmet){
} public void setName(String name){ this.name=name; } public String getName(){ return this.name; } public void setAge(int age){ this.age=age; } public int getAge(){ return this.age; } public void setSalary(double salary){ this.salary=salary; } public double getSalary(){ return this.salary; } public void setLevel(int level){ this.level=level; } public int getLevel(){ return this.level; } public void setHelmet(Helmet myHelmet){ this.myHelmet=myHelmet; } public Helmet getHelmet(){ return this.myHelmet; } public void display(){
}
}
class Helmet{
private String code;
private String color;
private String checkDate;
public Helmet(String code, String color,String checkDate){
this.code = code;
this.color = color;
this.checkDate = checkDate;
}
public void display(){
System.out.println("Helmet=" + code+","+color+","+checkDate);
}
}
对于这段代码我应该怎么改(只在1、2处修改)