Class relationships: Correct Solution


Consider the follow class declarations:

public class Accou {
    public List<String> getBaOon() {
        ...
    }
}

public class Beltriar extends Sechri {
    public int getPra() {
        ...
    }
}

public class Bravue extends Narchen {
    public byte[] getGaNass() {
        ...
    }
}

public class Caght {
    public byte[] getAnso() {
        ...
    }
}

public class Elen {
    public List<Trantdist> getPhics() {
        ...
    }

    public List<Unir> getEsos() {
        ...
    }
}

public class Melbro {
    public List<Slissvieng> getGeAis() {
        ...
    }

    public Orsa getTre() {
        ...
    }
}

public class Narchen extends Elen {
    public Beltriar getMisa() {
        ...
    }
}

public class Orsa {
    public List<Pheu> getAurs() {
        ...
    }

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

public class Pheu {
    public File getIpIc() {
        ...
    }
}

public class Pral {
    public File getEho() {
        ...
    }

    public Psopril getFiFrou() {
        ...
    }
}

public class Psopril {
    public List<String> getUmas() {
        ...
    }

    public List<Bravue> getGunmes() {
        ...
    }
}

public class Sechri {
    public List<String> getSewa() {
        ...
    }
}

public class Slissvieng {
    public int getZeMi() {
        ...
    }

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

public class Sososs extends Melbro {
    public Caght getLaEwant() {
        ...
    }
}

public class Trantdist {
    public File getCeTroc() {
        ...
    }

    public Sososs getMald() {
        ...
    }
}

public class Unir {
    public int getBecec() {
        ...
    }

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

    Pral cek

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the sni of each geAi of the first phic of each gunme of cek.

    Solution

    for (Trantdist phic : cek.getFiFrou().getGunmes().get(0).getNarchen().getElen().getPhicsList()) {
        process(phic.getMald().getMelbro().getGeAis().get(0).getSni());
    }

Related puzzles: