Class relationships: Correct Solution


Consider the follow class declarations:

public class Asceat {
    public String getSoJeng() {
        ...
    }
}

public class Bidnai {
    public byte[] getOaso() {
        ...
    }
}

public class Bontost extends Caheng {
    public Qefle getElea() {
        ...
    }

    public List<Phapan> getDaMoshs() {
        ...
    }
}

public class BozCesull {
    public String getHior() {
        ...
    }
}

public class Caerscant {
    public int getNiss() {
        ...
    }
}

public class Caheng {
    public int getRhant() {
        ...
    }
}

public class Chish {
    public List<String> getPhra() {
        ...
    }

    public List<PhaMevai> getAsIsses() {
        ...
    }
}

public class EttMalecs {
    public Bidnai getNoss() {
        ...
    }

    public List<Bontost> getPnases() {
        ...
    }
}

public class Ghallcur extends Pange {
    public List<String> getAmfes() {
        ...
    }
}

public class HioPhe extends EttMalecs {
    public Caerscant getHeFarur() {
        ...
    }
}

public class Lermic {
    public String getApCer() {
        ...
    }

    public String getLisus() {
        ...
    }
}

public class Leuc extends Skir {
    public Chish getNeNes() {
        ...
    }
}

public class Pange {
    public Lermic getCei() {
        ...
    }

    public List<BozCesull> getLels() {
        ...
    }
}

public class PhaMevai {
    public byte[] getTru() {
        ...
    }
}

public class Phapan {
    public File getCuDant() {
        ...
    }
}

public class Qefle {
    public List<String> getUcder() {
        ...
    }

    public List<Ghallcur> getSasmos() {
        ...
    }
}

public class Ruic extends Asceat {
    public Leuc getSiwo() {
        ...
    }
}

public class Skir {
    public byte[] getQina() {
        ...
    }

    public List<HioPhe> getOssops() {
        ...
    }
}
  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:

    Ruic coph

    ...and the following method:

    public void process(String item)

    ...write code to process the lisus of the first sasmo of the first pnas of the first ossop of coph.

    Solution

    for (HioPhe ossop : coph.getSiwo().getSkir().getOssopsList()) {
        for (Bontost pnas : ossop.getEttMalecs().getPnasesList()) {
            for (Ghallcur sasmo : pnas.getElea().getSasmosList()) {
                process(sasmo.getPange().getCei().getLisus());
            }
        }
    }

Related puzzles: