Class relationships: Correct Solution


Consider the follow class declarations:

public class Amont extends Luel {
    public List<Tred> getPenus() {
        ...
    }
}

public class Brou extends PriBislos {
    public String getSiSe() {
        ...
    }
}

public class Drei {
    public List<Touncu> getNapras() {
        ...
    }

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

public class Duzo extends WocGaelon {
    public Sessthi getBeUs() {
        ...
    }
}

public class Fisses {
    public File getPsen() {
        ...
    }
}

public class Grocsvi {
    public List<String> getPni() {
        ...
    }
}

public class Irspol {
    public List<String> getMusm() {
        ...
    }
}

public class Luel {
    public Irspol getCousm() {
        ...
    }

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

public class Meaengpha extends Nahe {
    public File getRenan() {
        ...
    }
}

public class Menni {
    public List<Fisses> getMios() {
        ...
    }

    public Duzo getEdSpal() {
        ...
    }
}

public class Nahe {
    public Onbel getCoMouoo() {
        ...
    }

    public String getCansa() {
        ...
    }
}

public class NecPoho {
    public List<String> getWama() {
        ...
    }

    public Amont getToHohid() {
        ...
    }
}

public class Odprus extends Swast {
    public Brou getMusap() {
        ...
    }
}

public class Onbel {
    public List<Grocsvi> getPiHars() {
        ...
    }

    public int getMinno() {
        ...
    }
}

public class PriBislos {
    public List<Spioff> getAcarms() {
        ...
    }

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

public class Sessthi {
    public String getSlec() {
        ...
    }
}

public class Smonon {
    public List<String> getTher() {
        ...
    }

    public Odprus getRuPhe() {
        ...
    }
}

public class Spioff {
    public List<String> getIpuc() {
        ...
    }

    public List<Menni> getKicas() {
        ...
    }
}

public class Swast {
    public Drei getPrur() {
        ...
    }

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

public class Tansaid extends Teti {
    public int getNic() {
        ...
    }
}

public class Teti {
    public int getTuc() {
        ...
    }

    public List<NecPoho> getGemins() {
        ...
    }
}

public class Touncu {
    public List<String> getLaEfric() {
        ...
    }
}

public class Tred extends Smonon {
    public String getOsva() {
        ...
    }
}

public class WocGaelon {
    public int getCior() {
        ...
    }

    public List<Meaengpha> getViangs() {
        ...
    }

    public int getEeThast() {
        ...
    }
}
  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:

    Tansaid tac

    ...and the following method:

    public void process(int item)

    ...write code to process the eeThast of the first kica of each acarm of the first penu of the first gemin of tac.

    Solution

    for (NecPoho gemin : tac.getTeti().getGeminsList()) {
        for (Tred penu : gemin.getToHohid().getPenusList()) {
            for (Menni kica : penu.getSmonon().getRuPhe().getMusap().getPriBislos().getAcarms().get(0).getKicasList()) {
                process(kica.getEdSpal().getWocGaelon().getEeThast());
            }
        }
    }

Related puzzles: