Class relationships: Correct Solution


Consider the follow class declarations:

public class Blawnbi {
    public List<Hoofia> getHaWis() {
        ...
    }

    public int getOnta() {
        ...
    }
}

public class Gloceck {
    public List<String> getWeTro() {
        ...
    }
}

public class Hoofia {
    public List<String> getPri() {
        ...
    }

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

public class Kinloe {
    public String getAsMi() {
        ...
    }
}

public class Poucna extends UndGurmor {
    public File getMeCinca() {
        ...
    }
}

public class Prevua extends Blawnbi {
    public Psin getStux() {
        ...
    }
}

public class Psin {
    public Rirvi getQaan() {
        ...
    }

    public Kinloe getStrer() {
        ...
    }
}

public class Rirvi {
    public File getCeus() {
        ...
    }

    public List<Gloceck> getCiIhas() {
        ...
    }
}

public class Sadar {
    public List<Poucna> getDiWhous() {
        ...
    }

    public File getPsabi() {
        ...
    }
}

public class UndGurmor {
    public File getPoCesio() {
        ...
    }

    public Prevua getIeng() {
        ...
    }
}
  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:

    Sadar truc

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the caruc of the first haWi of the first diWhou of truc.

    Solution

    for (Poucna diWhou : truc.getDiWhousList()) {
        for (Hoofia haWi : diWhou.getUndGurmor().getIeng().getBlawnbi().getHaWisList()) {
            process(haWi.getCaruc());
        }
    }

Related puzzles: