Class relationships: Correct Solution


Consider the follow class declarations:

public class Bagi {
    public File getNaIr() {
        ...
    }

    public List<RuiDalran> getIachos() {
        ...
    }
}

public class Casim extends Phol {
    public File getOiw() {
        ...
    }

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

public class Cecanch extends DoiDenptioung {
    public List<Chondvu> getPsirs() {
        ...
    }

    public Flionbec getUeEdtra() {
        ...
    }
}

public class Chassor {
    public byte[] getBuMi() {
        ...
    }
}

public class Chondvu {
    public String getVaSikoe() {
        ...
    }
}

public class DoiDenptioung {
    public File getMeis() {
        ...
    }
}

public class Durast {
    public List<Stic> getEeStis() {
        ...
    }

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

public class Endbo {
    public Massoll getPhees() {
        ...
    }

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

public class Flionbec extends Lospack {
    public List<Endbo> getPios() {
        ...
    }
}

public class HikEsm extends PraGohi {
    public int getCori() {
        ...
    }
}

public class Lospack {
    public File getPesic() {
        ...
    }
}

public class Maltcer {
    public Skesmness getMiar() {
        ...
    }

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

public class Massoll extends Bagi {
    public Pasmfia getHepec() {
        ...
    }
}

public class OssLilgrel extends Cecanch {
    public Chassor getCio() {
        ...
    }
}

public class Pasmfia {
    public List<String> getErHeong() {
        ...
    }
}

public class Phol {
    public byte[] getSavur() {
        ...
    }
}

public class PraGohi {
    public List<Durast> getIesses() {
        ...
    }

    public List<Casim> getAcEnangs() {
        ...
    }
}

public class RuiDalran {
    public Smirfess getEbi() {
        ...
    }

    public int getTiLos() {
        ...
    }
}

public class Skesmness {
    public File getAdIrtri() {
        ...
    }
}

public class Smirfess {
    public List<UarOrm> getUimtis() {
        ...
    }

    public Maltcer getIss() {
        ...
    }
}

public class Stic {
    public String getPrian() {
        ...
    }
}

public class UarOrm extends HikEsm {
    public byte[] getSwe() {
        ...
    }
}
  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:

    OssLilgrel tei

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the soOu of the first acEnang of the first uimti of each iacho of the first pio of tei.

    Solution

    for (Endbo pio : tei.getCecanch().getUeEdtra().getPiosList()) {
        for (UarOrm uimti : pio.getPhees().getBagi().getIachos().get(0).getEbi().getUimtisList()) {
            for (Casim acEnang : uimti.getHikEsm().getPraGohi().getAcEnangsList()) {
                process(acEnang.getSoOu());
            }
        }
    }

Related puzzles: