Class relationships: Correct Solution


Consider the follow class declarations:

public class Ason {
    public Ephos getWess() {
        ...
    }

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

public class Cheaffpess extends FiaScernta {
    public Wochong getCed() {
        ...
    }
}

public class Ephos extends Sturnuc {
    public List<Prisea> getDusses() {
        ...
    }
}

public class ErtAsrol extends Pesh {
    public Mismglan getRor() {
        ...
    }
}

public class Esar extends Ason {
    public Nesiss getHiCuqur() {
        ...
    }

    public List<Losm> getTeErgas() {
        ...
    }
}

public class FiaScernta {
    public File getIdTet() {
        ...
    }

    public Noxtho getTreb() {
        ...
    }
}

public class Fuph {
    public byte[] getJir() {
        ...
    }
}

public class Idpi {
    public int getOsel() {
        ...
    }
}

public class Losm {
    public int getGla() {
        ...
    }
}

public class Mismglan {
    public byte[] getUsem() {
        ...
    }

    public List<Cheaffpess> getMudons() {
        ...
    }
}

public class Nesiss extends Ussric {
    public List<Ringro> getFoHos() {
        ...
    }
}

public class Noxtho {
    public List<Esar> getIcols() {
        ...
    }

    public String getGred() {
        ...
    }
}

public class Ossnurm {
    public int getHopir() {
        ...
    }

    public String getGioos() {
        ...
    }
}

public class Pendmec extends ErtAsrol {
    public int getEsTudon() {
        ...
    }
}

public class Pesh {
    public List<Piol> getPruos() {
        ...
    }

    public Idpi getPanx() {
        ...
    }
}

public class Piol extends Fuph {
    public String getSaRhou() {
        ...
    }
}

public class Prisea {
    public List<Suicil> getAckens() {
        ...
    }

    public int getEbHece() {
        ...
    }
}

public class Ringro {
    public File getFresm() {
        ...
    }
}

public class Sturnuc {
    public String getOlox() {
        ...
    }
}

public class Suicil {
    public Ossnurm getEshis() {
        ...
    }

    public File getFlir() {
        ...
    }
}

public class Ussric {
    public byte[] getOuHa() {
        ...
    }
}

public class Wochong {
    public List<String> getEmfis() {
        ...
    }
}
  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:

    Pendmec si

    ...and the following method:

    public void process(String item)

    ...write code to process the gioos of each acken of each duss of the first icol of each mudon of si.

    Solution

    for (Esar icol : si.getErtAsrol().getRor().getMudons().get(0).getFiaScernta().getTreb().getIcolsList()) {
        process(icol.getAson().getWess().getDusses().get(0).getAckens().get(0).getEshis().getGioos());
    }

Related puzzles: