Class relationships: Correct Solution


Consider the follow class declarations:

public class Ceeet {
    public byte[] getAlDoan() {
        ...
    }
}

public class Cira {
    public byte[] getEcOr() {
        ...
    }
}

public class Geas extends Odpno {
    public List<String> getTaEr() {
        ...
    }
}

public class Geumcamn {
    public File getEsson() {
        ...
    }
}

public class Jiar {
    public byte[] getAnRalec() {
        ...
    }
}

public class Lecmass extends Mirmong {
    public byte[] getPaPec() {
        ...
    }
}

public class Mameng {
    public List<String> getSlast() {
        ...
    }
}

public class Meri extends Rhent {
    public Geas getGri() {
        ...
    }
}

public class Mirmong {
    public List<Poen> getFres() {
        ...
    }

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

public class Nicmeng {
    public byte[] getTro() {
        ...
    }

    public List<Geumcamn> getInUcbos() {
        ...
    }
}

public class Odpno {
    public int getTril() {
        ...
    }

    public List<Lecmass> getPheses() {
        ...
    }
}

public class Pipza {
    public int getCic() {
        ...
    }

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

public class Poen {
    public Tocsap getBeac() {
        ...
    }

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

public class Priplest extends Ceeet {
    public List<Pipza> getPrents() {
        ...
    }

    public Mameng getDomo() {
        ...
    }
}

public class Rhent {
    public List<String> getGian() {
        ...
    }
}

public class Tocsap extends Cira {
    public Nicmeng getSebka() {
        ...
    }

    public List<Jiar> getMiFrous() {
        ...
    }

    public Priplest getScri() {
        ...
    }
}
  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:

    Meri ge

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the cedas of the first prent of each fre of the first phes of ge.

    Solution

    for (Lecmass phes : ge.getGri().getOdpno().getPhesesList()) {
        for (Pipza prent : phes.getMirmong().getFres().get(0).getBeac().getScri().getPrentsList()) {
            process(prent.getCedas());
        }
    }

Related puzzles: