Class relationships: Correct Solution


Consider the follow class declarations:

public class Celfpre {
    public List<GecRocjiw> getEsesms() {
        ...
    }

    public File getErio() {
        ...
    }
}

public class Dushod {
    public File getErElci() {
        ...
    }
}

public class GecRocjiw extends Dushod {
    public List<Noae> getIlBiasts() {
        ...
    }

    public IpeCesspaw getGoBihas() {
        ...
    }
}

public class Ichpo {
    public List<String> getOcNiia() {
        ...
    }

    public Mijiad getMios() {
        ...
    }
}

public class IpeCesspaw extends Rarect {
    public List<String> getAimas() {
        ...
    }
}

public class Madim {
    public List<String> getManle() {
        ...
    }
}

public class Mijiad {
    public int getAsAirse() {
        ...
    }
}

public class Noae {
    public int getGuins() {
        ...
    }

    public Ichpo getFotra() {
        ...
    }
}

public class Ostco extends Pasmas {
    public int getPeSazes() {
        ...
    }
}

public class Pasmas {
    public int getSaFlism() {
        ...
    }

    public int getUede() {
        ...
    }
}

public class Picpe {
    public Ostco getSiEngsa() {
        ...
    }

    public int getCoAstto() {
        ...
    }
}

public class Rarect {
    public List<Picpe> getPacols() {
        ...
    }

    public List<Madim> getRiOrems() {
        ...
    }
}
  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:

    Celfpre tred

    ...and the following method:

    public void process(int item)

    ...write code to process the uede of each pacol of the first esesm of tred.

    Solution

    for (GecRocjiw esesm : tred.getEsesmsList()) {
        process(esesm.getGoBihas().getRarect().getPacols().get(0).getSiEngsa().getPasmas().getUede());
    }

Related puzzles: