Class relationships: Correct Solution


Consider the follow class declarations:

public class Anied {
    public String getSaMa() {
        ...
    }
}

public class Cewe {
    public List<String> getChood() {
        ...
    }
}

public class Cickpo {
    public int getMio() {
        ...
    }
}

public class Escloa {
    public Prentas getIsDiwa() {
        ...
    }

    public List<String> getHaQest() {
        ...
    }
}

public class Fertnad {
    public String getRuSom() {
        ...
    }

    public String getNonge() {
        ...
    }
}

public class Gloukal {
    public List<Uect> getWiorms() {
        ...
    }

    public Viasa getMesen() {
        ...
    }
}

public class Isshi extends Mercon {
    public List<Teallent> getNeRils() {
        ...
    }

    public List<Prou> getUcems() {
        ...
    }
}

public class Mercon {
    public List<Escloa> getCioases() {
        ...
    }

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

public class Ongcewn {
    public byte[] getRoOu() {
        ...
    }
}

public class Prassmards extends Pudsta {
    public Ongcewn getOiTruro() {
        ...
    }

    public Sengfil getUnt() {
        ...
    }

    public List<Anied> getIoUls() {
        ...
    }
}

public class Prentas {
    public List<String> getSlear() {
        ...
    }

    public List<Rioc> getCints() {
        ...
    }
}

public class Prou {
    public Cewe getHeon() {
        ...
    }

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

public class Pudsta {
    public Fertnad getPoNoeph() {
        ...
    }

    public List<String> getIxPri() {
        ...
    }
}

public class Rioc extends Gloukal {
    public byte[] getScir() {
        ...
    }
}

public class Sengfil extends Cickpo {
    public String getHiCi() {
        ...
    }
}

public class Teallent {
    public List<String> getCus() {
        ...
    }
}

public class Uect {
    public File getBonal() {
        ...
    }
}

public class Viasa {
    public String getAsnoe() {
        ...
    }

    public List<Prassmards> getClacos() {
        ...
    }
}
  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:

    Isshi pei

    ...and the following method:

    public void process(String item)

    ...write code to process the nonge of each claco of each cint of the first cioas of pei.

    Solution

    for (Escloa cioas : pei.getMercon().getCioasesList()) {
        process(cioas.getIsDiwa().getCints().get(0).getGloukal().getMesen().getClacos().get(0).getPudsta().getPoNoeph().getNonge());
    }

Related puzzles: