Class relationships: Correct Solution


Consider the follow class declarations:

public class Bilen {
    public String getCuLimru() {
        ...
    }
}

public class CeuOhi {
    public List<Bilen> getInDics() {
        ...
    }

    public List<Ciad> getEnwals() {
        ...
    }
}

public class Ciad {
    public String getPiar() {
        ...
    }

    public PriPriddo getSiIger() {
        ...
    }

    public File getDeat() {
        ...
    }
}

public class Clirtre {
    public Fandiu getUifa() {
        ...
    }

    public String getIosm() {
        ...
    }
}

public class Cusad {
    public File getIpa() {
        ...
    }
}

public class Deon extends Uphre {
    public String getBepro() {
        ...
    }
}

public class Ecke extends Enles {
    public List<Impo> getEcbus() {
        ...
    }
}

public class Enles {
    public String getSpoa() {
        ...
    }

    public List<Middo> getArcus() {
        ...
    }
}

public class Fandiu {
    public List<String> getJenge() {
        ...
    }
}

public class Fashcac {
    public String getPoHio() {
        ...
    }

    public Mianpror getSor() {
        ...
    }
}

public class Grel {
    public List<String> getBolid() {
        ...
    }
}

public class Impo extends Piom {
    public String getIduss() {
        ...
    }
}

public class Locnin {
    public File getGifec() {
        ...
    }
}

public class Mianpror extends CeuOhi {
    public String getOcMe() {
        ...
    }
}

public class Middo {
    public Deon getSchof() {
        ...
    }

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

public class Pibas extends Ecke {
    public String getDror() {
        ...
    }
}

public class Piom {
    public File getPrac() {
        ...
    }
}

public class Pranch {
    public int getDeAstu() {
        ...
    }
}

public class PriPriddo {
    public byte[] getPoptu() {
        ...
    }
}

public class Reurhasm extends Grel {
    public Clirtre getThid() {
        ...
    }

    public Sallti getIrm() {
        ...
    }

    public List<Pranch> getSehs() {
        ...
    }
}

public class Sallti {
    public List<Pibas> getFels() {
        ...
    }

    public Cusad getCiar() {
        ...
    }
}

public class Uphre extends Locnin {
    public List<Fashcac> getLecs() {
        ...
    }
}
  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:

    Reurhasm ta

    ...and the following method:

    public void process(File item)

    ...write code to process the deat of each enwal of the first lec of the first arcu of the first fel of ta.

    Solution

    for (Pibas fel : ta.getIrm().getFelsList()) {
        for (Middo arcu : fel.getEcke().getEnles().getArcusList()) {
            for (Fashcac lec : arcu.getSchof().getUphre().getLecsList()) {
                process(lec.getSor().getCeuOhi().getEnwals().get(0).getDeat());
            }
        }
    }

Related puzzles: