Class relationships: Correct Solution


Consider the follow class declarations:

public class Biostchro {
    public byte[] getFla() {
        ...
    }
}

public class CelHatou {
    public List<Mosus> getLoEeises() {
        ...
    }

    public File getOkoss() {
        ...
    }
}

public class Ciart {
    public List<Sudec> getAsEns() {
        ...
    }

    public File getUdOlal() {
        ...
    }
}

public class Cral extends Biostchro {
    public List<Fost> getSors() {
        ...
    }

    public List<Sterm> getHorifs() {
        ...
    }
}

public class Fost extends Trec {
    public File getAuse() {
        ...
    }
}

public class Grosmron extends Ismun {
    public CelHatou getOdad() {
        ...
    }
}

public class Ismun {
    public String getPris() {
        ...
    }

    public Tencio getAfste() {
        ...
    }
}

public class Mosus {
    public List<String> getChish() {
        ...
    }
}

public class Nabid {
    public String getDiWirho() {
        ...
    }
}

public class Ongchrasm {
    public File getVess() {
        ...
    }
}

public class PriRasteng {
    public Scluspri getInhie() {
        ...
    }

    public Nabid getChoai() {
        ...
    }
}

public class Scluspri extends Ciart {
    public int getLeac() {
        ...
    }
}

public class Sebo {
    public byte[] getOuCem() {
        ...
    }
}

public class Soirid {
    public int getRePra() {
        ...
    }

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

public class Sterm {
    public PriRasteng getDitri() {
        ...
    }

    public List<Viske> getFlocts() {
        ...
    }
}

public class Sudec extends Soirid {
    public List<String> getPaTi() {
        ...
    }
}

public class Tencio {
    public List<UntDessosh> getNiKeods() {
        ...
    }

    public List<Ongchrasm> getJints() {
        ...
    }
}

public class Trec {
    public File getDrom() {
        ...
    }
}

public class UntDessosh extends Cral {
    public Sebo getMaDoao() {
        ...
    }
}

public class Viske {
    public String getPle() {
        ...
    }
}
  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:

    Grosmron bre

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the geas of the first asEn of the first horif of the first niKeod of bre.

    Solution

    for (UntDessosh niKeod : bre.getIsmun().getAfste().getNiKeodsList()) {
        for (Sterm horif : niKeod.getCral().getHorifsList()) {
            for (Sudec asEn : horif.getDitri().getInhie().getCiart().getAsEnsList()) {
                process(asEn.getSoirid().getGeas());
            }
        }
    }

Related puzzles: