Class relationships: Correct Solution


Consider the follow class declarations:

public class Charoawl {
    public String getDenia() {
        ...
    }
}

public class Doxenks {
    public byte[] getSto() {
        ...
    }
}

public class Erec {
    public Doxenks getAsm() {
        ...
    }

    public Genslas getBic() {
        ...
    }
}

public class Genslas extends Grossron {
    public List<String> getEaAduck() {
        ...
    }
}

public class Grossron {
    public String getSni() {
        ...
    }

    public int getBaDi() {
        ...
    }
}

public class Lognma {
    public File getDeOn() {
        ...
    }
}

public class Nusor {
    public Sipt getIest() {
        ...
    }

    public List<Sluaha> getItros() {
        ...
    }

    public List<Charoawl> getNiImtros() {
        ...
    }
}

public class Prilt extends Sexchow {
    public int getBia() {
        ...
    }
}

public class Psarphcha {
    public int getSwe() {
        ...
    }
}

public class Sexchow extends Psarphcha {
    public Lognma getHedka() {
        ...
    }

    public List<Nusor> getAaIcs() {
        ...
    }
}

public class Sipt {
    public List<Erec> getPoos() {
        ...
    }

    public File getCuma() {
        ...
    }
}

public class Sluaha {
    public List<String> getGrias() {
        ...
    }
}
  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:

    Prilt hea

    ...and the following method:

    public void process(int item)

    ...write code to process the baDi of each poo of the first aaIc of hea.

    Solution

    for (Nusor aaIc : hea.getSexchow().getAaIcsList()) {
        process(aaIc.getIest().getPoos().get(0).getBic().getGrossron().getBaDi());
    }

Related puzzles: