Class relationships: Correct Solution


Consider the follow class declarations:

public class Cosgos {
    public List<Nool> getEpesses() {
        ...
    }

    public List<TreOte> getOsNunts() {
        ...
    }
}

public class Dunpant extends Cosgos {
    public Scre getAnIaul() {
        ...
    }

    public Toormpri getPaen() {
        ...
    }
}

public class Ipre extends Dunpant {
    public List<String> getDinen() {
        ...
    }
}

public class Nool {
    public byte[] getUpBic() {
        ...
    }
}

public class Parreng {
    public int getBivan() {
        ...
    }

    public List<Pral> getSaPus() {
        ...
    }
}

public class Pral extends Prola {
    public Ipre getSpen() {
        ...
    }
}

public class Prola {
    public String getMosi() {
        ...
    }
}

public class Scre {
    public String getBuThul() {
        ...
    }
}

public class Toormpri {
    public List<String> getDul() {
        ...
    }
}

public class TreOte {
    public byte[] getWeo() {
        ...
    }

    public File getArMadte() {
        ...
    }
}
  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:

    Parreng muf

    ...and the following method:

    public void process(File item)

    ...write code to process the arMadte of the first osNunt of each saPu of muf.

    Solution

    for (TreOte osNunt : muf.getSaPus().get(0).getSpen().getDunpant().getCosgos().getOsNuntsList()) {
        process(osNunt.getArMadte());
    }

Related puzzles: