Class relationships: Correct Solution


Consider the follow class declarations:

public class Chri {
    public List<String> getErmod() {
        ...
    }

    public List<Ecen> getUiPrasses() {
        ...
    }
}

public class Cinpi {
    public List<Voss> getArhes() {
        ...
    }

    public String getFiid() {
        ...
    }
}

public class Doseff {
    public String getAlCae() {
        ...
    }
}

public class Ecen {
    public File getCin() {
        ...
    }
}

public class Fengsta {
    public File getGarta() {
        ...
    }
}

public class Fessvad {
    public File getSni() {
        ...
    }
}

public class Hongi {
    public List<Socesm> getSpengs() {
        ...
    }

    public List<Doseff> getInOxtes() {
        ...
    }
}

public class Ibot extends Ptami {
    public Icbe getRaHosa() {
        ...
    }
}

public class Icbe {
    public String getRar() {
        ...
    }
}

public class Ings {
    public int getPeCowin() {
        ...
    }

    public File getHaOamar() {
        ...
    }
}

public class Oadda {
    public File getAsuc() {
        ...
    }
}

public class OtiMiscen {
    public List<Ings> getIsSpests() {
        ...
    }

    public Oadda getOsCrel() {
        ...
    }
}

public class Ptami extends OtiMiscen {
    public Fessvad getVepoa() {
        ...
    }

    public List<Fengsta> getOnEas() {
        ...
    }
}

public class Socesm {
    public Ibot getMocbu() {
        ...
    }

    public String getMipe() {
        ...
    }
}

public class Uour extends Hongi {
    public byte[] getAsfi() {
        ...
    }
}

public class Voss {
    public Uour getNaDahpa() {
        ...
    }

    public Chri getTunta() {
        ...
    }
}
  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:

    Cinpi spu

    ...and the following method:

    public void process(File item)

    ...write code to process the haOamar of each isSpest of each speng of the first arhe of spu.

    Solution

    for (Voss arhe : spu.getArhesList()) {
        process(arhe.getNaDahpa().getHongi().getSpengs().get(0).getMocbu().getPtami().getOtiMiscen().getIsSpests().get(0).getHaOamar());
    }

Related puzzles: