Java 代码有效,但不确定我是否满足要求(对象和 类)

Java code works, but unsure if I have fulfilled the requirements (objects and classes)

我收到了这个作业要求,我已经为它写了一个解决方案。但不确定我是否得到了正确的答案。 代码运行并编译。

Question

这是我的 java 文件(2 个文件)

首先是主文件

public class Employee
{
String name;
int idNumber;
String department;
String position;

public Employee(String emName, int idNum, String depart, String pos)
{
    name = emName;
    idNumber = idNum;
    department= depart;
    position = pos;
}

public Employee(String emName, int idNum)
{
    name = emName;
    idNumber = idNum;
    department= "";
    position = "";
}

public Employee()
{
    name = "";
    idNumber = 0;
    department= "";
    position = "";
}

//set name
public void setName(String nameSet)
{
    name = nameSet;
}

//get name
public String getName()
{
    String nameGet = name;
    return nameGet;
}

//set idnum
public void setID(int idSet)
{
    idNumber = idSet;
}

//get idnum
public int getId()
{
    int idGet = idNumber;
    return idGet;
}

//
//set department
public void setDep(String depSet)
{
    department = depSet;
}

//get department
public String getDep()
{
    String depGet = department;
    return depGet;
}

//
//set position
public void setPos(String posSet)
{
    position = posSet;
}

//get position
public String getPos()
{
    String posGet = position;
    return posGet;
}

}

第二次添加数据并打印数据

       public class Employee_test
{
public static void main(String[] args)
{
    Employee employee1 = new Employee("Susan Meyers", 47899, "Accounting", "Vice President");
    Employee employee2 = new Employee("Mark Jones", 39119, "IT", "Programmer"); //use second with Mark
    //Employee employee2 = new Employee("Mark Jones", 39119);
    Employee employee3 = new Employee("Joy Rogers", 81774, "Manufacturing", "Engineer"); //use third with Joy
    //Employee employee3 = new Employee();

    System.out.println("Name           ID Number   Department     Position");
    System.out.println("");
    System.out.println(employee1.getName() + "   " + employee1.getId() +  "       " + employee1.getDep() + "     " + employee1.getPos());
    System.out.println(employee2.getName() + "     " + employee2.getId() +  "       " + employee2.getDep() + "             " + employee2.getPos());
    System.out.println(employee3.getName() + "     " + employee3.getId() +  "       " + employee3.getDep() + "  " + employee3.getPos());
    System.out.println("");
}

}

这是我 运行 employee_test 文件时的输出。

Output terminal

我在迷茫什么。

问题说

Make sure you use all three constructors. Use the first constructor with Susan, the second with Mark and the third one with Joy.

如果问题想让第二个员工使用一个只有(name, id number)而第三个没有任何东西的构造函数,如何实现输出()。 提前致谢。

使用setters填写其他数据:

Employee employee1 = new Employee("Susan Meyers", 47899, "Accounting", "Vice President");

Employee employee2 = new Employee("Mark Jones", 39119);
employee2.setDep("IT");
employee2.setPos("Programmer");

Employee employee3 = new Employee();
employee3.setName("Joy Rogers");
employee3.setID(81774);
employee3.setDep("Manufacturing");
employee3.setPos("Engineer");

请注意,从设计的角度来看,所有字段都应为 private,并且 ID 也应为 final,因为一旦 ID 不会更改雇员被创建。如果此人更改姓名(婚姻、证人保护等),name 字段可能会发生变化,其他字段可能会不时发生变化。