Class relationships: Correct Solution


Consider the follow class declarations:

public class Arooc {
    public int getDamec() {
        ...
    }
}

public class Choal {
    public List<Pioldon> getGlios() {
        ...
    }

    public List<Arooc> getEflels() {
        ...
    }
}

public class Cilih {
    public List<Peddult> getOsmocs() {
        ...
    }

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

public class Cishpant {
    public List<String> getPiru() {
        ...
    }
}

public class Diros extends Hildad {
    public List<String> getEntis() {
        ...
    }
}

public class Driccac {
    public Cishpant getRoTagir() {
        ...
    }

    public File getGeAs() {
        ...
    }
}

public class Floen {
    public List<Phoscack> getHefus() {
        ...
    }

    public List<Driccac> getTrises() {
        ...
    }
}

public class Gleonpes {
    public byte[] getAdta() {
        ...
    }
}

public class Gluvin extends Pralon {
    public List<Inis> getRorels() {
        ...
    }
}

public class Hildad {
    public String getDio() {
        ...
    }

    public List<Mounme> getWaCedios() {
        ...
    }
}

public class Inis {
    public File getKuss() {
        ...
    }
}

public class Istslal {
    public int getXidel() {
        ...
    }
}

public class Juin {
    public List<Choal> getSios() {
        ...
    }

    public Teme getLicio() {
        ...
    }
}

public class Mermue extends Cilih {
    public String getRol() {
        ...
    }
}

public class Mounme {
    public Gluvin getAoFirra() {
        ...
    }

    public String getIss() {
        ...
    }
}

public class Paroud {
    public Juin getRaas() {
        ...
    }

    public Istslal getDiBurvo() {
        ...
    }
}

public class Peddult {
    public File getFasco() {
        ...
    }

    public String getAdgam() {
        ...
    }
}

public class Phoscack {
    public File getUger() {
        ...
    }
}

public class Pioldon extends Sissen {
    public Diros getGonte() {
        ...
    }
}

public class Pralon extends Gleonpes {
    public Mermue getHirec() {
        ...
    }

    public Floen getSpre() {
        ...
    }
}

public class Sissen {
    public List<Whil> getNels() {
        ...
    }

    public String getHeHijal() {
        ...
    }
}

public class Swocis extends Paroud {
    public byte[] getCas() {
        ...
    }
}

public class Teme {
    public File getBuRa() {
        ...
    }
}

public class Whil {
    public List<String> getMiReld() {
        ...
    }
}
  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:

    Swocis un

    ...and the following method:

    public void process(String item)

    ...write code to process the adgam of each osmoc of the first waCedio of each glio of the first sio of un.

    Solution

    for (Choal sio : un.getParoud().getRaas().getSiosList()) {
        for (Mounme waCedio : sio.getGlios().get(0).getGonte().getHildad().getWaCediosList()) {
            process(waCedio.getAoFirra().getPralon().getHirec().getCilih().getOsmocs().get(0).getAdgam());
        }
    }

Related puzzles: