Class relationships: Correct Solution


Consider the follow class declarations:

public class CaoSerscho {
    public File getIcot() {
        ...
    }
}

public class Celan {
    public File getEdQogo() {
        ...
    }
}

public class Cossor {
    public File getSkas() {
        ...
    }
}

public class Fesshas extends MecTriti {
    public String getBeIp() {
        ...
    }
}

public class Ioscal {
    public List<String> getRaUk() {
        ...
    }
}

public class Jaurshuss {
    public File getIaNec() {
        ...
    }
}

public class Mascost extends Merant {
    public List<Celan> getBris() {
        ...
    }
}

public class MecTriti {
    public File getHouc() {
        ...
    }

    public Neded getCes() {
        ...
    }
}

public class Merant extends Shewhi {
    public List<Jaurshuss> getTokas() {
        ...
    }

    public Ioscal getKow() {
        ...
    }

    public List<Pecas> getEnsis() {
        ...
    }
}

public class Neded extends Priodiod {
    public List<Talfir> getSoos() {
        ...
    }
}

public class Pecas {
    public List<String> getOrge() {
        ...
    }
}

public class Priodiod {
    public String getBism() {
        ...
    }
}

public class Reuma extends CaoSerscho {
    public Stulcuou getOakar() {
        ...
    }

    public List<Fesshas> getCibets() {
        ...
    }
}

public class Shewhi {
    public Reuma getLeIang() {
        ...
    }

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

public class Sphourd {
    public Stal getAder() {
        ...
    }

    public String getMuNucas() {
        ...
    }
}

public class Stal {
    public Cossor getAsSi() {
        ...
    }

    public List<Mascost> getTasms() {
        ...
    }
}

public class Stulcuou {
    public String getPra() {
        ...
    }
}

public class Talfir {
    public byte[] getZotma() {
        ...
    }

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

    Sphourd elos

    ...and the following method:

    public void process(int item)

    ...write code to process the omScie of each soo of the first cibet of each tasm of elos.

    Solution

    for (Fesshas cibet : elos.getAder().getTasms().get(0).getMerant().getShewhi().getLeIang().getCibetsList()) {
        process(cibet.getMecTriti().getCes().getSoos().get(0).getOmScie());
    }

Related puzzles: