Class relationships: Correct Solution


Consider the follow class declarations:

public class Anpa {
    public int getRiSe() {
        ...
    }

    public Lecte getAchin() {
        ...
    }
}

public class Antfio extends Ousti {
    public Preft getFeMastu() {
        ...
    }
}

public class Brai {
    public File getSholl() {
        ...
    }
}

public class Jentdid {
    public List<String> getHalow() {
        ...
    }
}

public class Lecte {
    public File getHess() {
        ...
    }
}

public class Meis extends Sasop {
    public int getEsron() {
        ...
    }
}

public class Ousti extends Jentdid {
    public Simdiss getRodin() {
        ...
    }
}

public class Preft {
    public int getAnbec() {
        ...
    }
}

public class Putrad {
    public List<Antfio> getEnts() {
        ...
    }

    public List<Brai> getMaas() {
        ...
    }
}

public class Sasop {
    public Putrad getCaMa() {
        ...
    }

    public int getLaNirot() {
        ...
    }
}

public class Simdiss {
    public File getReVe() {
        ...
    }

    public String getNopra() {
        ...
    }
}

public class Vuntbec extends Anpa {
    public List<Meis> getSqacas() {
        ...
    }
}
  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:

    Vuntbec phim

    ...and the following method:

    public void process(String item)

    ...write code to process the nopra of the first ent of each sqaca of phim.

    Solution

    for (Antfio ent : phim.getSqacas().get(0).getSasop().getCaMa().getEntsList()) {
        process(ent.getOusti().getRodin().getNopra());
    }

Related puzzles: