Class relationships: Correct Solution


Consider the follow class declarations:

public class Aern {
    public int getDegun() {
        ...
    }

    public Sengstric getBaPhe() {
        ...
    }
}

public class Bophnad extends Spid {
    public List<Risfle> getTeis() {
        ...
    }
}

public class Boscrias extends Swoicre {
    public Aern getPibru() {
        ...
    }
}

public class Corvec {
    public byte[] getDac() {
        ...
    }

    public Nelhin getLeCiss() {
        ...
    }
}

public class DedWopho {
    public String getQiLioda() {
        ...
    }
}

public class Ente {
    public String getPube() {
        ...
    }
}

public class Hantderm extends Ente {
    public String getBao() {
        ...
    }
}

public class Holin {
    public List<DedWopho> getFises() {
        ...
    }

    public String getCiSqad() {
        ...
    }
}

public class Nelhin {
    public Pinjuism getLoue() {
        ...
    }

    public List<Testrent> getLidus() {
        ...
    }
}

public class Pahoc {
    public String getQebal() {
        ...
    }
}

public class Pinjuism {
    public int getBie() {
        ...
    }
}

public class Qant {
    public List<String> getNic() {
        ...
    }

    public List<Boscrias> getEgmeses() {
        ...
    }
}

public class Recight {
    public List<Holin> getStos() {
        ...
    }

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

public class Rhussstoun {
    public Zacfres getNaOal() {
        ...
    }

    public List<Testod> getMalids() {
        ...
    }
}

public class Risfle {
    public File getWhi() {
        ...
    }
}

public class Sengstric extends Pahoc {
    public Hantderm getGaVarac() {
        ...
    }

    public List<Bophnad> getCitas() {
        ...
    }
}

public class Spid extends Rhussstoun {
    public int getEiPo() {
        ...
    }
}

public class Swoicre {
    public byte[] getPec() {
        ...
    }
}

public class Testod {
    public File getOrso() {
        ...
    }

    public int getGiass() {
        ...
    }
}

public class Testrent extends Qant {
    public List<String> getCagla() {
        ...
    }
}

public class Wesod extends Corvec {
    public Recight getNehid() {
        ...
    }
}

public class Zacfres {
    public String getDuss() {
        ...
    }
}
  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:

    Wesod cic

    ...and the following method:

    public void process(int item)

    ...write code to process the giass of each malid of each cita of each egmes of the first lidu of cic.

    Solution

    for (Testrent lidu : cic.getCorvec().getLeCiss().getLidusList()) {
        process(lidu.getQant().getEgmeses().get(0).getPibru().getBaPhe().getCitas().get(0).getSpid().getRhussstoun().getMalids().get(0).getGiass());
    }

Related puzzles: