public class hia
{
String name;
public ArrayList<hia> subordonat=new ArrayList<>();
public hia(String name)
{
this.name=name;
}
public void add(hia e)
{
subordonat.add(e);
}
public void print() {
System.out.println(name);
for (hia e : subordonat)
{
e.print();
}
}
public void delete()
{
for(hia e:subordonat)
{
if(name=="Unavailable")
{
}
}
}
}
So, my main problem is that I made this tree that's suppose to emulate the hierarchy of a company (like any employee has an n
number of subordinates that he manages, and those also have subordinates, and so on) and what I have to make is a function that will delete any employee that has his name as "unavailable," along with all his subordinates.
However, I haven't worked much on trees and I don t really know what to do.