Class relationships: Correct Solution


Consider the follow class declarations:

public class AngThikiod {
    public OstNeso getOnEd() {
        ...
    }

    public List<GruPalf> getIeurs() {
        ...
    }
}

public class Bera extends Dupel {
    public AngThikiod getMeut() {
        ...
    }
}

public class Drensi {
    public int getEnas() {
        ...
    }

    public List<Prosbi> getReEacks() {
        ...
    }
}

public class Dupel {
    public File getPansi() {
        ...
    }

    public Drensi getAsac() {
        ...
    }
}

public class Emon {
    public int getFuan() {
        ...
    }
}

public class GruPalf extends Ouwun {
    public List<String> getCeess() {
        ...
    }
}

public class Irmhe {
    public File getModde() {
        ...
    }

    public List<Bera> getCamis() {
        ...
    }
}

public class OstNeso {
    public byte[] getAchel() {
        ...
    }
}

public class Ouwun {
    public File getIlErda() {
        ...
    }

    public Thoups getRass() {
        ...
    }
}

public class Pign extends Irmhe {
    public int getSamil() {
        ...
    }
}

public class Prir {
    public String getViduf() {
        ...
    }
}

public class Prosbi {
    public String getCelal() {
        ...
    }
}

public class Spacsdau {
    public File getIus() {
        ...
    }

    public String getEeSqel() {
        ...
    }
}

public class Thoups extends Emon {
    public List<Spacsdau> getAsapts() {
        ...
    }

    public Prir getAnCo() {
        ...
    }
}
  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:

    Pign oed

    ...and the following method:

    public void process(String item)

    ...write code to process the eeSqel of each asapt of each ieur of the first cami of oed.

    Solution

    for (Bera cami : oed.getIrmhe().getCamisList()) {
        process(cami.getMeut().getIeurs().get(0).getOuwun().getRass().getAsapts().get(0).getEeSqel());
    }

Related puzzles: