Class relationships: Correct Solution


Consider the follow class declarations:

public class Aeas extends Brel {
    public byte[] getHeag() {
        ...
    }
}

public class Asmto extends Sqasm {
    public String getAstas() {
        ...
    }

    public File getRohol() {
        ...
    }
}

public class Brel extends Locdim {
    public byte[] getDisac() {
        ...
    }
}

public class Ewhes {
    public KesSidhint getDaqia() {
        ...
    }

    public File getFesod() {
        ...
    }
}

public class Hado {
    public int getBept() {
        ...
    }
}

public class HecWheth {
    public byte[] getUas() {
        ...
    }
}

public class Ietroun {
    public byte[] getDeEr() {
        ...
    }
}

public class KesSidhint {
    public List<Ietroun> getOnepses() {
        ...
    }

    public List<Aeas> getGreds() {
        ...
    }
}

public class Locdim {
    public List<Asmto> getNeCancus() {
        ...
    }

    public String getCasm() {
        ...
    }
}

public class Muce {
    public int getPive() {
        ...
    }
}

public class Pesm {
    public int getAsmsa() {
        ...
    }
}

public class Rhaja extends Hado {
    public byte[] getIthid() {
        ...
    }
}

public class Sardast {
    public Pesm getAnPheos() {
        ...
    }

    public List<Spinil> getIpecs() {
        ...
    }
}

public class Seeed {
    public Rhaja getCrul() {
        ...
    }

    public Sardast getPhra() {
        ...
    }
}

public class Spinil extends Ewhes {
    public byte[] getCiect() {
        ...
    }
}

public class Sqasm {
    public List<Muce> getSefirs() {
        ...
    }

    public HecWheth getCeos() {
        ...
    }
}
  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:

    Seeed sesa

    ...and the following method:

    public void process(File item)

    ...write code to process the rohol of the first neCancu of each gred of the first ipec of sesa.

    Solution

    for (Spinil ipec : sesa.getPhra().getIpecsList()) {
        for (Asmto neCancu : ipec.getEwhes().getDaqia().getGreds().get(0).getBrel().getLocdim().getNeCancusList()) {
            process(neCancu.getRohol());
        }
    }

Related puzzles: