Class relationships: Correct Solution


Consider the follow class declarations:

public class Bawush {
    public String getSti() {
        ...
    }
}

public class Crios extends Croent {
    public List<Trolic> getMicts() {
        ...
    }
}

public class Croent extends Bawush {
    public int getOiser() {
        ...
    }

    public File getCosm() {
        ...
    }
}

public class Eisa {
    public int getSesau() {
        ...
    }
}

public class Napsus {
    public Crios getVong() {
        ...
    }

    public int getErid() {
        ...
    }
}

public class Oeng {
    public String getPuMa() {
        ...
    }
}

public class Ougu {
    public Thre getPodca() {
        ...
    }

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

public class Pefan extends Ougu {
    public byte[] getPiSurgi() {
        ...
    }
}

public class PioProxmen {
    public List<Oeng> getElsans() {
        ...
    }

    public List<Napsus> getPhics() {
        ...
    }
}

public class SpuKestlorm {
    public byte[] getCeIer() {
        ...
    }
}

public class Thre {
    public List<PioProxmen> getTroums() {
        ...
    }

    public Eisa getCaAs() {
        ...
    }

    public SpuKestlorm getAdSobil() {
        ...
    }
}

public class Trolic {
    public int getLaosh() {
        ...
    }
}
  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:

    Pefan il

    ...and the following method:

    public void process(File item)

    ...write code to process the cosm of the first phic of each troum of il.

    Solution

    for (Napsus phic : il.getOugu().getPodca().getTroums().get(0).getPhicsList()) {
        process(phic.getVong().getCroent().getCosm());
    }

Related puzzles: