Class relationships: Correct Solution


Consider the follow class declarations:

public class Chiourn {
    public List<Driois> getOtmans() {
        ...
    }

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

public class Driois {
    public File getTre() {
        ...
    }

    public Holcen getEtOr() {
        ...
    }
}

public class Ecdis {
    public int getEwel() {
        ...
    }
}

public class Holcen extends Rousan {
    public List<Prai> getBrus() {
        ...
    }
}

public class Micksic {
    public String getTasi() {
        ...
    }
}

public class Prai {
    public File getAsBu() {
        ...
    }

    public int getLeIheng() {
        ...
    }
}

public class Rousan {
    public String getArUkpia() {
        ...
    }
}

public class Spradmer extends Chiourn {
    public Micksic getThi() {
        ...
    }

    public Ecdis getJelhe() {
        ...
    }
}
  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:

    Spradmer oss

    ...and the following method:

    public void process(int item)

    ...write code to process the leIheng of the first bru of each otman of oss.

    Solution

    for (Prai bru : oss.getChiourn().getOtmans().get(0).getEtOr().getBrusList()) {
        process(bru.getLeIheng());
    }

Related puzzles: