Class relationships: Correct Solution


Consider the follow class declarations:

public class Ceweng extends Divac {
    public Motchal getMooss() {
        ...
    }
}

public class Coand extends Ostmel {
    public List<Coulpam> getEaNahos() {
        ...
    }
}

public class Coulpam {
    public String getAclec() {
        ...
    }
}

public class Divac {
    public List<String> getEsh() {
        ...
    }
}

public class EciTethor extends Geamha {
    public Loicbe getCri() {
        ...
    }
}

public class Fedud {
    public byte[] getImLosa() {
        ...
    }
}

public class Geamha {
    public byte[] getEbrus() {
        ...
    }
}

public class Hadcra extends Psalchlol {
    public File getToWixce() {
        ...
    }
}

public class Iort {
    public File getIrshu() {
        ...
    }
}

public class Liwlsa {
    public Hadcra getEtu() {
        ...
    }

    public int getKinsa() {
        ...
    }
}

public class Loicbe {
    public int getAsHuour() {
        ...
    }
}

public class Motchal extends Taed {
    public List<Iort> getMeIprocs() {
        ...
    }

    public List<Fedud> getRoucs() {
        ...
    }

    public List<Silsen> getFlas() {
        ...
    }
}

public class Ostmel {
    public PraAng getLus() {
        ...
    }

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

public class PraAng extends Winsa {
    public byte[] getPruid() {
        ...
    }
}

public class Psalchlol {
    public byte[] getAdJu() {
        ...
    }

    public String getChla() {
        ...
    }
}

public class Rhoss {
    public List<Coand> getEnis() {
        ...
    }

    public File getSpel() {
        ...
    }
}

public class Silsen {
    public File getVash() {
        ...
    }
}

public class SneHonsheur {
    public int getHec() {
        ...
    }
}

public class Taed {
    public List<Liwlsa> getFisos() {
        ...
    }

    public EciTethor getVihi() {
        ...
    }
}

public class Winsa {
    public List<Ceweng> getHiPhiees() {
        ...
    }

    public SneHonsheur getDaCias() {
        ...
    }
}
  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:

    Rhoss ur

    ...and the following method:

    public void process(String item)

    ...write code to process the chla of each fiso of each hiPhiee of the first eni of ur.

    Solution

    for (Coand eni : ur.getEnisList()) {
        process(eni.getOstmel().getLus().getWinsa().getHiPhiees().get(0).getMooss().getTaed().getFisos().get(0).getEtu().getPsalchlol().getChla());
    }

Related puzzles: