アプリのメイン メソッドで従業員クラスのオブジェクトを作成しようとしていますが、部門の lastName firstName または給与の変数が見つかりません。なぜこれが私のステートメントのようになるのかわかりません
Employee employee = new Employee( department, lastName, firstName, salary);
従業員クラスは次のようになります
package javaapplication14;
public class Employee implements DepartmentConstants, Displayable
{
private int department;
private String firstName;
private String lastName;
private double salary;
public Employee(int department, String lastName, String firstName,
double salary)
{
this.department = department;
this.lastName = lastName;
this.firstName = firstName;
this.salary = salary;
}
@Override
public String getDisplayText()
{
String displayText = firstName + lastName + salary + department ;
return displayText;
}
}
インターフェイスの実装を表示する必要があるかどうかはわかりませんが、表示する場合は投稿を編集してそれらを含めます。主な方法は、
package javaapplication14;
public class DisplayableTestApp
{
public static void main(String args[])
{
System.out.println("Welcome to the Displayable Test application\n");
// create an Employee object
Employee employee = new Employee( department, lastName, firstName, salary);
// display the employee information
String displayTextEmployee = employee.getDisplayText();
System.out.println(displayTextEmployee);
// create a Product object
Product product = new Product();
// display the product information
String displayText = product.getDisplayText();
System.out.println(displayText);
}
}