Class relationships: Correct Solution


Consider the follow class declarations:

public class AcoSte {
    public Paec getOiod() {
        ...
    }

    public Fistuss getNafi() {
        ...
    }
}

public class Antder extends Phesglon {
    public List<Osmock> getFacmas() {
        ...
    }
}

public class BieCesh extends Pinoc {
    public byte[] getProuw() {
        ...
    }

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

public class Bontra {
    public byte[] getKuEin() {
        ...
    }
}

public class Caend extends BieCesh {
    public File getAnge() {
        ...
    }
}

public class Chriarhing extends EucMedsa {
    public List<String> getSeou() {
        ...
    }
}

public class Cimu {
    public List<SuaThie> getPaests() {
        ...
    }

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

public class Cuer {
    public Prolpar getMeec() {
        ...
    }

    public int getBeea() {
        ...
    }
}

public class Distrit {
    public byte[] getEeWirk() {
        ...
    }

    public Sarlo getMemol() {
        ...
    }
}

public class EucMedsa {
    public List<AcoSte> getGiUcks() {
        ...
    }

    public String getIrm() {
        ...
    }
}

public class Fistuss extends Sanant {
    public byte[] getOrni() {
        ...
    }
}

public class Intsor {
    public File getMeLacin() {
        ...
    }
}

public class OlfPnasbar {
    public List<String> getCiAner() {
        ...
    }
}

public class Osmock {
    public int getCiss() {
        ...
    }

    public Rert getSaSqefi() {
        ...
    }
}

public class Paec {
    public List<Intsor> getIcEcoms() {
        ...
    }

    public List<Caend> getRarts() {
        ...
    }
}

public class Phesglon extends Cuer {
    public List<Bontra> getSpaus() {
        ...
    }

    public List<Distrit> getViSoerds() {
        ...
    }
}

public class Pinoc {
    public File getJoed() {
        ...
    }
}

public class Prolpar {
    public byte[] getInja() {
        ...
    }
}

public class Rert {
    public File getEllun() {
        ...
    }

    public OlfPnasbar getUiCa() {
        ...
    }
}

public class Sanant {
    public List<String> getPrass() {
        ...
    }
}

public class Sarlo extends Cimu {
    public File getStear() {
        ...
    }
}

public class SnaEldant {
    public List<String> getIli() {
        ...
    }

    public Antder getOond() {
        ...
    }
}

public class SuaThie {
    public Chriarhing getMuRi() {
        ...
    }

    public List<Whal> getIashs() {
        ...
    }
}

public class Whal {
    public String getInAc() {
        ...
    }
}
  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:

    SnaEldant u

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the repe of the first rart of the first giUck of the first paest of each viSoerd of u.

    Solution

    for (SuaThie paest : u.getOond().getPhesglon().getViSoerds().get(0).getMemol().getCimu().getPaestsList()) {
        for (AcoSte giUck : paest.getMuRi().getEucMedsa().getGiUcksList()) {
            for (Caend rart : giUck.getOiod().getRartsList()) {
                process(rart.getBieCesh().getRepe());
            }
        }
    }

Related puzzles: