Class relationships: Correct Solution


Consider the follow class declarations:

public class Anmun extends Montec {
    public int getAng() {
        ...
    }
}

public class Cegam {
    public List<Diab> getTros() {
        ...
    }

    public Prea getSedou() {
        ...
    }
}

public class Cuxcest {
    public List<String> getLehic() {
        ...
    }
}

public class Demia extends Iasmbo {
    public File getHemi() {
        ...
    }
}

public class Desva {
    public List<String> getVict() {
        ...
    }
}

public class Diab {
    public int getCas() {
        ...
    }
}

public class Geife extends Houi {
    public List<Ossesh> getPsuds() {
        ...
    }
}

public class Gran {
    public String getShar() {
        ...
    }
}

public class Hecosm extends Gran {
    public byte[] getEpwi() {
        ...
    }
}

public class Hivia {
    public List<Cegam> getSeApsis() {
        ...
    }

    public String getSti() {
        ...
    }
}

public class Houi {
    public Desva getPelep() {
        ...
    }

    public Zochist getKni() {
        ...
    }
}

public class Iacgouck {
    public List<Ressmict> getDichas() {
        ...
    }

    public List<Seerqest> getPsefts() {
        ...
    }
}

public class Iasmbo {
    public Hivia getFioss() {
        ...
    }

    public File getMioil() {
        ...
    }
}

public class Laissem extends Iacgouck {
    public File getOrNal() {
        ...
    }
}

public class Montec {
    public int getOrden() {
        ...
    }
}

public class Ossesh extends Anmun {
    public String getEulk() {
        ...
    }
}

public class Prea {
    public List<Primen> getBohoses() {
        ...
    }

    public SpoCiangge getJor() {
        ...
    }
}

public class Primen {
    public List<String> getAnCed() {
        ...
    }

    public File getOourk() {
        ...
    }
}

public class Ressmict {
    public Geife getVios() {
        ...
    }

    public int getSasm() {
        ...
    }
}

public class Seerqest {
    public int getShull() {
        ...
    }
}

public class SpoCiangge {
    public List<String> getCoGrac() {
        ...
    }
}

public class Zochist extends Cuxcest {
    public Hecosm getDrasm() {
        ...
    }

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

    Laissem rerm

    ...and the following method:

    public void process(File item)

    ...write code to process the oourk of each bohos of each seApsi of the first osAssu of the first dicha of rerm.

    Solution

    for (Ressmict dicha : rerm.getIacgouck().getDichasList()) {
        for (Demia osAssu : dicha.getVios().getHoui().getKni().getOsAssusList()) {
            process(osAssu.getIasmbo().getFioss().getSeApsis().get(0).getSedou().getBohoses().get(0).getOourk());
        }
    }

Related puzzles: