Class relationships: Correct Solution


Consider the follow class declarations:

public class Cidstrar {
    public String getCaSapu() {
        ...
    }
}

public class Destpsi extends DraSclarerks {
    public List<String> getClosi() {
        ...
    }
}

public class DraSclarerks {
    public Tasbe getOssew() {
        ...
    }

    public int getPiral() {
        ...
    }
}

public class Egrong extends Paist {
    public String getPreje() {
        ...
    }
}

public class Idroch {
    public int getScre() {
        ...
    }
}

public class OssPsatosm extends Idroch {
    public List<Whecpec> getNiFofons() {
        ...
    }
}

public class Paist {
    public ThuWhass getCea() {
        ...
    }

    public List<Cidstrar> getSeses() {
        ...
    }
}

public class Tasbe {
    public byte[] getDaHecon() {
        ...
    }

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

public class ThuWhass {
    public List<Destpsi> getCishes() {
        ...
    }

    public OssPsatosm getIoOmdon() {
        ...
    }
}

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

    Egrong tiia

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the prort of the first cishe of tiia.

    Solution

    for (Destpsi cishe : tiia.getPaist().getCea().getCishesList()) {
        process(cishe.getDraSclarerks().getOssew().getPrort());
    }

Related puzzles: