Class relationships: Correct Solution


Consider the follow class declarations:

public class Ahwu {
    public List<String> getCica() {
        ...
    }

    public List<Itas> getIdecs() {
        ...
    }
}

public class Dentsta {
    public byte[] getUcir() {
        ...
    }

    public String getProi() {
        ...
    }
}

public class Disi {
    public Dentsta getMelk() {
        ...
    }

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

public class Firdud {
    public int getGru() {
        ...
    }
}

public class Genblea extends Disi {
    public Ongtosm getIpras() {
        ...
    }

    public Firdud getSios() {
        ...
    }

    public List<Tioi> getTuEts() {
        ...
    }
}

public class Itas {
    public int getTwer() {
        ...
    }

    public List<Genblea> getAngs() {
        ...
    }
}

public class Losint {
    public List<String> getRhor() {
        ...
    }
}

public class Ongtosm {
    public String getPtad() {
        ...
    }
}

public class Precer extends Losint {
    public VemCoulvoed getStoli() {
        ...
    }
}

public class Stushoerth {
    public String getEkRiboo() {
        ...
    }
}

public class Tioi {
    public byte[] getWaAncen() {
        ...
    }
}

public class VemCoulvoed extends Ahwu {
    public List<Stushoerth> getHeSlihis() {
        ...
    }
}
  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:

    Precer sqa

    ...and the following method:

    public void process(String item)

    ...write code to process the proi of the first ang of the first idec of sqa.

    Solution

    for (Itas idec : sqa.getStoli().getAhwu().getIdecsList()) {
        for (Genblea ang : idec.getAngsList()) {
            process(ang.getDisi().getMelk().getProi());
        }
    }

Related puzzles: