Class relationships: Correct Solution


Consider the follow class declarations:

public class Baneas {
    public byte[] getRiLaece() {
        ...
    }

    public PriNunca getIltu() {
        ...
    }
}

public class Crast {
    public List<String> getHesor() {
        ...
    }
}

public class EcaOss {
    public List<Toci> getRheuls() {
        ...
    }

    public List<String> getBiele() {
        ...
    }

    public byte[] getPrac() {
        ...
    }
}

public class Entma {
    public byte[] getEhont() {
        ...
    }

    public Meou getPhess() {
        ...
    }
}

public class Gidsu {
    public List<Pses> getStes() {
        ...
    }

    public File getPrir() {
        ...
    }
}

public class Hintbed {
    public List<Entma> getKehirs() {
        ...
    }

    public List<Splang> getRoLas() {
        ...
    }
}

public class Lofol {
    public List<Qeapzi> getHous() {
        ...
    }

    public Spusha getIho() {
        ...
    }
}

public class Meou extends EcaOss {
    public Scinbe getSlen() {
        ...
    }

    public Crast getMaHe() {
        ...
    }

    public Serhi getIlOg() {
        ...
    }
}

public class Phua {
    public byte[] getPrus() {
        ...
    }
}

public class PriNunca extends Hintbed {
    public List<String> getApi() {
        ...
    }
}

public class Pses extends Scoong {
    public File getPeSkod() {
        ...
    }
}

public class Qeapzi {
    public String getMeac() {
        ...
    }
}

public class RerSorrid extends Baneas {
    public File getPseli() {
        ...
    }
}

public class Scinbe extends Phua {
    public String getSana() {
        ...
    }
}

public class Scoong {
    public List<String> getEhir() {
        ...
    }

    public Wantmenct getMealt() {
        ...
    }
}

public class Serhi {
    public String getDric() {
        ...
    }
}

public class Splang {
    public List<String> getEsId() {
        ...
    }
}

public class Spusha {
    public byte[] getKoPadal() {
        ...
    }
}

public class Toci {
    public File getWhur() {
        ...
    }
}

public class Wantmenct extends Lofol {
    public List<RerSorrid> getNaens() {
        ...
    }
}
  1. Draw a diagram showing the class relationships.

    You only need to diagram the classes listed above. You only need to show the name of each class; do not show their methods or properties.

    Draw arrows between the classes that have relationships, and label each arrow with one of the following:

    Make sure your arrows point in the correct direction!

    Solution

  2. Given the following variable:

    Gidsu haho

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the prac of the first kehir of the first naen of each ste of haho.

    Solution

    for (RerSorrid naen : haho.getStes().get(0).getScoong().getMealt().getNaensList()) {
        for (Entma kehir : naen.getBaneas().getIltu().getHintbed().getKehirsList()) {
            process(kehir.getPhess().getEcaOss().getPrac());
        }
    }

Related puzzles: