Class relationships: Correct Solution


Consider the follow class declarations:

public class Bexlo extends Mawstral {
    public File getAng() {
        ...
    }
}

public class Bimar {
    public String getEnwhe() {
        ...
    }

    public List<Pemiar> getBics() {
        ...
    }
}

public class Biss {
    public int getTaMasno() {
        ...
    }

    public Olaur getMue() {
        ...
    }
}

public class CioDrowi {
    public byte[] getCholk() {
        ...
    }

    public EghVoss getSuleo() {
        ...
    }
}

public class Croghtbrel {
    public Bexlo getCeSa() {
        ...
    }

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

public class Dudpu {
    public File getNoar() {
        ...
    }

    public List<Thred> getEaHes() {
        ...
    }
}

public class EghVoss {
    public File getSeass() {
        ...
    }

    public List<Eitphad> getOsts() {
        ...
    }
}

public class Eitphad {
    public String getNise() {
        ...
    }

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

public class Fiart {
    public File getBroki() {
        ...
    }
}

public class Mawstral extends Dudpu {
    public List<Fiart> getLepons() {
        ...
    }

    public Bimar getLiGini() {
        ...
    }
}

public class Olaur extends Urwa {
    public String getIprer() {
        ...
    }
}

public class Pemiar {
    public List<String> getEflea() {
        ...
    }
}

public class Skouss {
    public List<String> getFeshi() {
        ...
    }

    public List<Croghtbrel> getEsEms() {
        ...
    }
}

public class SliMaess extends Biss {
    public byte[] getIar() {
        ...
    }
}

public class Thred extends SliMaess {
    public CioDrowi getTirte() {
        ...
    }
}

public class Urwa {
    public File getPoili() {
        ...
    }
}
  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:

    Skouss elol

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the eca of the first ost of the first eaHe of the first esEm of elol.

    Solution

    for (Croghtbrel esEm : elol.getEsEmsList()) {
        for (Thred eaHe : esEm.getCeSa().getMawstral().getDudpu().getEaHesList()) {
            for (Eitphad ost : eaHe.getTirte().getSuleo().getOstsList()) {
                process(ost.getEca());
            }
        }
    }

Related puzzles: