Class relationships: Correct Solution


Consider the follow class declarations:

public class Barmbri {
    public File getAdIonsu() {
        ...
    }

    public List<Helhi> getCoCas() {
        ...
    }
}

public class Chosh extends Secan {
    public Barmbri getEant() {
        ...
    }
}

public class Chucknan extends Hantus {
    public TruMestseuc getEtgil() {
        ...
    }
}

public class Fesm {
    public byte[] getNuess() {
        ...
    }
}

public class Hantus {
    public int getDisac() {
        ...
    }

    public List<Chosh> getPosbos() {
        ...
    }
}

public class Helhi extends Mawean {
    public Irhen getBiKiol() {
        ...
    }

    public List<Fesm> getEssbes() {
        ...
    }
}

public class Irhen {
    public File getMeNitra() {
        ...
    }

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

public class Mawean {
    public String getMaIl() {
        ...
    }
}

public class Secan {
    public String getKec() {
        ...
    }
}

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

    Chucknan um

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the tirs of each coCa of the first posbo of um.

    Solution

    for (Chosh posbo : um.getHantus().getPosbosList()) {
        process(posbo.getEant().getCoCas().get(0).getBiKiol().getTirs());
    }

Related puzzles: