Class relationships: Correct Solution


Consider the follow class declarations:

public class Coldosh extends Faran {
    public int getPrien() {
        ...
    }
}

public class Cron {
    public byte[] getHiIpro() {
        ...
    }

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

public class Escuac {
    public byte[] getUsmdi() {
        ...
    }
}

public class Faran extends Trurme {
    public Jenpo getEoEnes() {
        ...
    }
}

public class Gostvel extends Escuac {
    public List<PaoGeeess> getIomeds() {
        ...
    }

    public List<Cron> getRises() {
        ...
    }

    public Jucbil getOcIc() {
        ...
    }
}

public class Jenpo {
    public List<Maus> getGiArs() {
        ...
    }

    public File getSaSo() {
        ...
    }
}

public class Jucbil {
    public int getSpod() {
        ...
    }
}

public class Maus {
    public Gostvel getFiss() {
        ...
    }

    public String getRiar() {
        ...
    }
}

public class PaoGeeess {
    public String getIai() {
        ...
    }
}

public class Trurme {
    public byte[] getMarsa() {
        ...
    }
}
  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:

    Coldosh sqo

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the suSheec of the first ris of the first giAr of sqo.

    Solution

    for (Maus giAr : sqo.getFaran().getEoEnes().getGiArsList()) {
        for (Cron ris : giAr.getFiss().getRisesList()) {
            process(ris.getSuSheec());
        }
    }

Related puzzles: