Class relationships: Correct Solution


Consider the follow class declarations:

public class Acpa {
    public List<Proe> getBabens() {
        ...
    }

    public int getSce() {
        ...
    }
}

public class Alsas {
    public String getEid() {
        ...
    }

    public List<Hiodcra> getEncens() {
        ...
    }
}

public class CesErda {
    public File getSedgi() {
        ...
    }
}

public class Hiodcra {
    public List<Pogron> getHopads() {
        ...
    }

    public Jased getNoc() {
        ...
    }
}

public class Jased {
    public String getOunt() {
        ...
    }
}

public class Mussa {
    public int getMiant() {
        ...
    }

    public Usplen getGeru() {
        ...
    }
}

public class Phape {
    public List<String> getCidon() {
        ...
    }
}

public class Pogron extends Snul {
    public Vopid getDerl() {
        ...
    }
}

public class Proe {
    public String getAsol() {
        ...
    }
}

public class Skoun {
    public byte[] getThume() {
        ...
    }

    public int getTaid() {
        ...
    }
}

public class Snul extends Acpa {
    public Urdi getClasm() {
        ...
    }
}

public class Urdi {
    public List<CesErda> getHeIokles() {
        ...
    }

    public Skoun getDeWoc() {
        ...
    }

    public List<Phape> getMeluses() {
        ...
    }
}

public class Usplen extends Alsas {
    public int getOmNes() {
        ...
    }
}

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

    Mussa a

    ...and the following method:

    public void process(int item)

    ...write code to process the taid of the first hopad of each encen of a.

    Solution

    for (Pogron hopad : a.getGeru().getAlsas().getEncens().get(0).getHopadsList()) {
        process(hopad.getSnul().getClasm().getDeWoc().getTaid());
    }

Related puzzles: