Class relationships: Correct Solution


Consider the follow class declarations:

public class AngHudke {
    public byte[] getDisia() {
        ...
    }

    public Pheo getIrBorm() {
        ...
    }
}

public class Casi {
    public List<Scheckua> getAlPrehes() {
        ...
    }

    public Iprol getRalpo() {
        ...
    }
}

public class CeoEnte extends Wennef {
    public int getReWoi() {
        ...
    }

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

public class Chasstal {
    public List<AngHudke> getReaaps() {
        ...
    }

    public Psingel getCoux() {
        ...
    }
}

public class Cucpsach {
    public byte[] getBiCron() {
        ...
    }
}

public class Idcor extends Cucpsach {
    public CeoEnte getSpeo() {
        ...
    }

    public Viun getEnEsm() {
        ...
    }
}

public class Ioss extends Idcor {
    public List<String> getMeAmo() {
        ...
    }
}

public class Iprol extends Sted {
    public List<String> getTrir() {
        ...
    }
}

public class Linar {
    public String getPruc() {
        ...
    }
}

public class Pheo extends Preod {
    public File getCuIss() {
        ...
    }
}

public class PraBintwent {
    public List<String> getIsmje() {
        ...
    }
}

public class Preod {
    public List<Ioss> getPemlus() {
        ...
    }

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

public class Psingel {
    public File getCilge() {
        ...
    }

    public List<Linar> getPinras() {
        ...
    }
}

public class Scheckua {
    public List<String> getDoong() {
        ...
    }
}

public class Sted {
    public List<Chasstal> getIsshos() {
        ...
    }

    public Volsos getUka() {
        ...
    }

    public List<PraBintwent> getPoShrods() {
        ...
    }
}

public class Viun {
    public int getHoSpe() {
        ...
    }
}

public class Volsos {
    public int getTrec() {
        ...
    }
}

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

    Casi udso

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the deFi of the first pemlu of each reaap of the first issho of udso.

    Solution

    for (Chasstal issho : udso.getRalpo().getSted().getIsshosList()) {
        for (Ioss pemlu : issho.getReaaps().get(0).getIrBorm().getPreod().getPemlusList()) {
            process(pemlu.getIdcor().getSpeo().getDeFi());
        }
    }

Related puzzles: