Class relationships: Correct Solution


Consider the follow class declarations:

public class Ahau {
    public String getThu() {
        ...
    }

    public List<Iosmes> getOmephs() {
        ...
    }
}

public class Boir {
    public List<String> getRass() {
        ...
    }
}

public class Chorth extends Garaid {
    public byte[] getMaUdred() {
        ...
    }
}

public class Eush {
    public List<String> getOgei() {
        ...
    }
}

public class Garaid {
    public List<Pharan> getErCidas() {
        ...
    }

    public String getCou() {
        ...
    }
}

public class Gerhe {
    public File getPiTrec() {
        ...
    }

    public OonPhas getCeGe() {
        ...
    }
}

public class Grismced {
    public byte[] getBeIssid() {
        ...
    }
}

public class Iosmes extends Ripmioc {
    public Chorth getUss() {
        ...
    }

    public OoxBaprol getGles() {
        ...
    }
}

public class Mesria {
    public File getDre() {
        ...
    }
}

public class OonPhas extends Ahau {
    public List<String> getEdScoa() {
        ...
    }
}

public class OoxBaprol {
    public List<String> getPodor() {
        ...
    }
}

public class Pesess {
    public byte[] getIcIamou() {
        ...
    }
}

public class Pharan {
    public List<String> getOccod() {
        ...
    }

    public List<Mesria> getEnSencos() {
        ...
    }

    public String getHos() {
        ...
    }
}

public class Proadrus {
    public List<Gerhe> getLaNedexs() {
        ...
    }

    public File getAmio() {
        ...
    }
}

public class Qucond extends Skontlais {
    public Pesess getRaStiod() {
        ...
    }

    public Proadrus getPrur() {
        ...
    }

    public Grismced getCaOr() {
        ...
    }

    public List<Boir> getSuMais() {
        ...
    }
}

public class Ripmioc {
    public int getAeSto() {
        ...
    }

    public List<Eush> getNenus() {
        ...
    }
}

public class Skontlais {
    public File getCooss() {
        ...
    }
}

public class Veptbur extends Qucond {
    public byte[] getAlel() {
        ...
    }
}
  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:

    Veptbur teod

    ...and the following method:

    public void process(String item)

    ...write code to process the hos of the first erCida of each omeph of the first laNedex of teod.

    Solution

    for (Gerhe laNedex : teod.getQucond().getPrur().getLaNedexsList()) {
        for (Pharan erCida : laNedex.getCeGe().getAhau().getOmephs().get(0).getUss().getGaraid().getErCidasList()) {
            process(erCida.getHos());
        }
    }

Related puzzles: