Class relationships: Correct Solution


Consider the follow class declarations:

public class Bihi extends Trasmqe {
    public String getPhe() {
        ...
    }
}

public class Ceesnerth {
    public byte[] getRhoun() {
        ...
    }
}

public class Easti extends Istli {
    public Psoke getMiFle() {
        ...
    }
}

public class Frous {
    public List<Easti> getAnmins() {
        ...
    }

    public List<Ceesnerth> getHegses() {
        ...
    }
}

public class Gaulci {
    public File getToip() {
        ...
    }
}

public class Istli {
    public List<String> getIzan() {
        ...
    }
}

public class Licu {
    public File getSwei() {
        ...
    }

    public Setrec getCies() {
        ...
    }

    public File getIliol() {
        ...
    }
}

public class Psoke {
    public List<SneCinman> getSiPos() {
        ...
    }

    public List<Theong> getEgisses() {
        ...
    }
}

public class Punmix {
    public byte[] getOdTrae() {
        ...
    }
}

public class Setrec {
    public String getMuEbra() {
        ...
    }
}

public class SneCinman {
    public byte[] getMaPibem() {
        ...
    }

    public Punmix getSont() {
        ...
    }
}

public class Stapair extends Licu {
    public int getHaLeha() {
        ...
    }
}

public class Theong extends Stapair {
    public String getArNaho() {
        ...
    }
}

public class Trasmqe {
    public Frous getPhan() {
        ...
    }

    public Gaulci getMoClir() {
        ...
    }
}
  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:

    Bihi osh

    ...and the following method:

    public void process(File item)

    ...write code to process the iliol of each egiss of the first anmin of osh.

    Solution

    for (Easti anmin : osh.getTrasmqe().getPhan().getAnminsList()) {
        process(anmin.getMiFle().getEgisses().get(0).getStapair().getLicu().getIliol());
    }

Related puzzles: