Class relationships: Correct Solution


Consider the follow class declarations:

public class Crua {
    public int getDed() {
        ...
    }
}

public class Dodnar extends Huinga {
    public List<Thoudil> getCicils() {
        ...
    }

    public Hersplan getBolge() {
        ...
    }
}

public class Ghoim extends Henex {
    public List<String> getScred() {
        ...
    }
}

public class Henex extends Khic {
    public List<Shendight> getTaVens() {
        ...
    }
}

public class Hersplan {
    public byte[] getJac() {
        ...
    }
}

public class Huinga {
    public SeuItdil getSuoss() {
        ...
    }

    public List<Letang> getHauses() {
        ...
    }
}

public class Khic {
    public File getNapi() {
        ...
    }
}

public class Letang {
    public String getVoEde() {
        ...
    }
}

public class Meslang extends Sespi {
    public List<Miwproid> getEsms() {
        ...
    }
}

public class Miwproid {
    public Sadrent getPessi() {
        ...
    }

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

public class Noss {
    public int getWoAn() {
        ...
    }
}

public class Pemb {
    public List<Ghoim> getSians() {
        ...
    }

    public Crua getItPrar() {
        ...
    }
}

public class Radma {
    public File getUcre() {
        ...
    }
}

public class RalCerod {
    public int getChes() {
        ...
    }
}

public class Sadrent {
    public Radma getBiou() {
        ...
    }

    public Noss getPaFe() {
        ...
    }

    public List<Dodnar> getCases() {
        ...
    }
}

public class Sespi {
    public File getPhash() {
        ...
    }
}

public class SeuItdil {
    public Pemb getOdCousm() {
        ...
    }

    public int getInve() {
        ...
    }
}

public class Shendight extends RalCerod {
    public int getElEt() {
        ...
    }

    public String getSeo() {
        ...
    }
}

public class Thoudil {
    public File getCoras() {
        ...
    }
}

public class Toul extends Meslang {
    public List<String> getPruss() {
        ...
    }
}
  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:

    Toul wi

    ...and the following method:

    public void process(String item)

    ...write code to process the seo of each taVen of each sian of the first cas of each esm of wi.

    Solution

    for (Dodnar cas : wi.getMeslang().getEsms().get(0).getPessi().getCasesList()) {
        process(cas.getHuinga().getSuoss().getOdCousm().getSians().get(0).getHenex().getTaVens().get(0).getSeo());
    }

Related puzzles: