Who is who

Report a typo

You are given a class hierarchy consisting of three classes. The base class is Employee. The first subclass is Developer, the second subclass is DataAnalyst.

Implement a method determineWhoIsWho. The method takes an array of employees. Each element belongs to one of the listed classes. The method should output the type (DEV, EMP or DA) of each element in a new line.

Use the provided template for your method.

Output example

DEV
EMP
DA
Write a program in Java 17
import java.util.Arrays;

class Determiner {

public static void determineWhoIsWho(Employee[] employees) {
for (Employee employee : employees) {
System.out.println("EMP");
}
}
}

// Don't change the code below
class Employee {

protected String name;
protected String email;
protected int experience;

public Employee(String name, String email, int experience) {
this.name = name;
this.email = email;
this.experience = experience;
}

public String getName() {
return name;
}

public String getEmail() {
return email;
}

public int getExperience() {
return experience;
}
}
___

Create a free account to access the full topic