Class relationships: Correct Solution


Consider the follow class declarations:

public class Acal {
    public byte[] getIfio() {
        ...
    }

    public Hien getTrint() {
        ...
    }
}

public class BucSethil {
    public byte[] getOsbat() {
        ...
    }
}

public class Elfi {
    public List<String> getEnThra() {
        ...
    }
}

public class Hien extends Vississ {
    public Phei getGueng() {
        ...
    }
}

public class MecHiorcee {
    public byte[] getCabil() {
        ...
    }

    public Sirbe getSiguc() {
        ...
    }
}

public class Narm {
    public String getSlal() {
        ...
    }
}

public class PheSpeckda {
    public Pidko getUsEl() {
        ...
    }

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

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

public class Phei {
    public String getEqel() {
        ...
    }
}

public class Pidko {
    public byte[] getOcUant() {
        ...
    }
}

public class Piechro {
    public String getUnCi() {
        ...
    }
}

public class Puless extends Acal {
    public int getEph() {
        ...
    }
}

public class Sirbe {
    public Elfi getInUanre() {
        ...
    }

    public List<Puless> getAdEsengs() {
        ...
    }

    public List<Narm> getPrids() {
        ...
    }
}

public class Viass extends BucSethil {
    public List<PheSpeckda> getNeGlids() {
        ...
    }
}

public class Vississ extends Piechro {
    public List<Viass> getEdRis() {
        ...
    }
}
  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:

    MecHiorcee eol

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the aolt of the first neGlid of the first edRi of the first adEseng of eol.

    Solution

    for (Puless adEseng : eol.getSiguc().getAdEsengsList()) {
        for (Viass edRi : adEseng.getAcal().getTrint().getVississ().getEdRisList()) {
            for (PheSpeckda neGlid : edRi.getNeGlidsList()) {
                process(neGlid.getAolt());
            }
        }
    }

Related puzzles: