Class relationships: Correct Solution


Consider the follow class declarations:

public class Busm {
    public Phaeo getMoEs() {
        ...
    }

    public int getAnmar() {
        ...
    }
}

public class Fuirlcreou {
    public byte[] getWeVeudo() {
        ...
    }
}

public class Lacern extends Xert {
    public int getPalbe() {
        ...
    }
}

public class Phaeo extends Prasm {
    public PtiCrismmiss getSeala() {
        ...
    }
}

public class Prasm {
    public File getCoCride() {
        ...
    }
}

public class Psoordis {
    public Vacshe getSqap() {
        ...
    }

    public int getBopel() {
        ...
    }
}

public class Ptesi {
    public File getCioce() {
        ...
    }
}

public class PtiCrismmiss extends Ptesi {
    public List<Lacern> getPsils() {
        ...
    }
}

public class Qass {
    public String getThi() {
        ...
    }
}

public class Swenaun {
    public List<Fuirlcreou> getFraeps() {
        ...
    }

    public byte[] getSoSu() {
        ...
    }

    public File getEuphi() {
        ...
    }
}

public class Tosbe extends Uessring {
    public List<Psoordis> getAeshs() {
        ...
    }
}

public class Uessring {
    public List<String> getNeMu() {
        ...
    }

    public List<Busm> getIsMas() {
        ...
    }
}

public class Vacshe {
    public String getVoni() {
        ...
    }
}

public class Xert {
    public List<Qass> getMaungs() {
        ...
    }

    public Swenaun getBlim() {
        ...
    }
}
  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:

    Tosbe ri

    ...and the following method:

    public void process(File item)

    ...write code to process the euphi of the first psil of the first isMa of ri.

    Solution

    for (Busm isMa : ri.getUessring().getIsMasList()) {
        for (Lacern psil : isMa.getMoEs().getSeala().getPsilsList()) {
            process(psil.getXert().getBlim().getEuphi());
        }
    }

Related puzzles: