Class relationships: Correct Solution


Consider the follow class declarations:

public class CaeCoutchro {
    public int getErnan() {
        ...
    }
}

public class Casle extends OltMithdiong {
    public List<Speled> getPiVeekus() {
        ...
    }
}

public class Cini extends Troon {
    public byte[] getMish() {
        ...
    }
}

public class Depca {
    public Cini getDeou() {
        ...
    }

    public Eunda getAcou() {
        ...
    }
}

public class EulFelim {
    public Icli getEed() {
        ...
    }

    public Casle getSein() {
        ...
    }
}

public class Eunda {
    public byte[] getTriss() {
        ...
    }
}

public class Fornpod {
    public String getBeIruc() {
        ...
    }
}

public class Giopest {
    public File getIndod() {
        ...
    }

    public Strun getRis() {
        ...
    }
}

public class GoeJexthial {
    public byte[] getHiud() {
        ...
    }

    public String getArbli() {
        ...
    }
}

public class Hothuct extends Fornpod {
    public GoeJexthial getPeing() {
        ...
    }

    public List<Issprer> getSwuns() {
        ...
    }
}

public class Icli {
    public String getArPhirn() {
        ...
    }
}

public class Issprer {
    public CaeCoutchro getCecet() {
        ...
    }

    public byte[] getMoPid() {
        ...
    }
}

public class Lorpra {
    public List<Risan> getPirwes() {
        ...
    }

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

public class Messmer {
    public List<String> getNooc() {
        ...
    }
}

public class Nouna extends Hothuct {
    public Pustderd getAnRenze() {
        ...
    }
}

public class OltMithdiong {
    public byte[] getLiSe() {
        ...
    }

    public List<Nouna> getRocbes() {
        ...
    }
}

public class Ourgrost {
    public byte[] getIiUist() {
        ...
    }
}

public class PhePratru extends Racie {
    public byte[] getAsm() {
        ...
    }
}

public class Pustderd {
    public File getOnks() {
        ...
    }
}

public class Racie {
    public List<Giopest> getNaIns() {
        ...
    }

    public List<Ourgrost> getDomous() {
        ...
    }
}

public class Risan {
    public int getHuael() {
        ...
    }
}

public class Speled {
    public List<String> getExIint() {
        ...
    }

    public Messmer getOush() {
        ...
    }
}

public class Strun {
    public List<String> getOtecs() {
        ...
    }

    public List<Depca> getEdCos() {
        ...
    }
}

public class Troon {
    public List<Lorpra> getEnSiiars() {
        ...
    }

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

    PhePratru ska

    ...and the following method:

    public void process(String item)

    ...write code to process the arbli of each rocbe of the first ipwu of the first edCo of each naIn of ska.

    Solution

    for (Depca edCo : ska.getRacie().getNaIns().get(0).getRis().getEdCosList()) {
        for (EulFelim ipwu : edCo.getDeou().getTroon().getIpwusList()) {
            process(ipwu.getSein().getOltMithdiong().getRocbes().get(0).getHothuct().getPeing().getArbli());
        }
    }

Related puzzles: