Class relationships: Correct Solution


Consider the follow class declarations:

public class Aimen extends Pieshod {
    public List<Nebon> getErmis() {
        ...
    }
}

public class Chor extends Mehell {
    public List<String> getEssda() {
        ...
    }
}

public class Coci extends Varhi {
    public Lassad getIrRo() {
        ...
    }
}

public class Erod {
    public List<String> getTosan() {
        ...
    }
}

public class Ertcom {
    public List<Nath> getSaios() {
        ...
    }

    public File getCeBre() {
        ...
    }
}

public class Fisne {
    public List<String> getInass() {
        ...
    }
}

public class Grec extends Sorang {
    public List<String> getAuer() {
        ...
    }
}

public class Iasmind {
    public int getImec() {
        ...
    }
}

public class Iodac {
    public File getWoLal() {
        ...
    }
}

public class Lassad {
    public File getEssce() {
        ...
    }
}

public class Mapism {
    public String getFim() {
        ...
    }

    public List<Ertcom> getKurbs() {
        ...
    }
}

public class Mehell {
    public int getSqec() {
        ...
    }

    public Mapism getOsCozec() {
        ...
    }
}

public class Nath {
    public List<String> getVasi() {
        ...
    }

    public PekVantiad getEcHabo() {
        ...
    }
}

public class Nebon extends Ostra {
    public Thougo getItas() {
        ...
    }
}

public class Ostra {
    public byte[] getTior() {
        ...
    }
}

public class PekVantiad {
    public List<String> getEuPra() {
        ...
    }

    public int getTosox() {
        ...
    }
}

public class Pieshod {
    public File getEoSiad() {
        ...
    }
}

public class Rodast {
    public List<String> getIcs() {
        ...
    }
}

public class Sorang extends Iasmind {
    public List<Chor> getHoRiurs() {
        ...
    }
}

public class SpiSispen extends Aimen {
    public Rodast getPaChuc() {
        ...
    }

    public List<Fisne> getRiesms() {
        ...
    }
}

public class Thougo {
    public List<Coci> getHejas() {
        ...
    }

    public Grec getBia() {
        ...
    }

    public Erod getPecac() {
        ...
    }
}

public class Varhi {
    public List<Iodac> getCels() {
        ...
    }

    public byte[] getMoSuon() {
        ...
    }
}
  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:

    SpiSispen tira

    ...and the following method:

    public void process(int item)

    ...write code to process the tosox of each saio of each kurb of each hoRiur of the first ermi of tira.

    Solution

    for (Nebon ermi : tira.getAimen().getErmisList()) {
        process(ermi.getItas().getBia().getSorang().getHoRiurs().get(0).getMehell().getOsCozec().getKurbs().get(0).getSaios().get(0).getEcHabo().getTosox());
    }

Related puzzles: