jeudi 5 octobre 2017

Java "Registering"(Storing) and removing "Employees"

I have a class called Employee and now I want to write a class called ReusaxCorp. Each employee at the company has an ID, a name and a gross salary, that can later be retrieved. The ReusaxCorp class should register and remove Employees (beginning with no employee). The problem I have is, that I don't know how I can register employees and store them. Furthermore, I was told to use polymorphism. Here's the Employee class:

public class Employee {

    private String ID;
    private String name;
    private int grosssalary; 

    public Employee (String ID, String name, int grosssalary){
        this.ID = ID;
        this.name = name;
        this.grosssalary = grosssalary;
    }


    public int getGrosssalary() {
        return grosssalary;
    }

    public void setGrosssalary(int grosssalary) {
        this.grosssalary = grosssalary;
    }

    public void setName(String name) {
        this.name = name;
    }
}

Aucun commentaire:

Enregistrer un commentaire