Class relationships: Correct Solution


Consider the follow class declarations:

public class Catuan {
    public String getAarp() {
        ...
    }
}

public class CinChorblall {
    public String getCiUirl() {
        ...
    }

    public Peesa getCaTrunt() {
        ...
    }
}

public class Dosmtear {
    public int getVoss() {
        ...
    }
}

public class EbeRhossoss extends HosMosthou {
    public File getRoPe() {
        ...
    }
}

public class Erdswa {
    public List<Leph> getOcEsreds() {
        ...
    }

    public int getAeSphe() {
        ...
    }
}

public class HosMosthou {
    public Mioal getPioo() {
        ...
    }

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

public class Ipio {
    public List<String> getIciph() {
        ...
    }
}

public class Kemaff {
    public List<EbeRhossoss> getGeis() {
        ...
    }

    public List<Catuan> getCaus() {
        ...
    }
}

public class Lenpaft {
    public byte[] getEeSmist() {
        ...
    }
}

public class Leph extends Stiwnproul {
    public byte[] getDeki() {
        ...
    }
}

public class Mioal {
    public byte[] getSuPlusm() {
        ...
    }

    public List<CinChorblall> getTurdes() {
        ...
    }
}

public class Peesa extends Erdswa {
    public Dosmtear getIcIcwa() {
        ...
    }

    public Pran getReSni() {
        ...
    }

    public Psost getHeght() {
        ...
    }
}

public class Pran extends Socbrol {
    public List<Ipio> getVeds() {
        ...
    }
}

public class Psost {
    public String getUiva() {
        ...
    }
}

public class Socbrol {
    public int getPri() {
        ...
    }
}

public class Stiwnproul extends Lenpaft {
    public List<String> getGecal() {
        ...
    }

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

    Kemaff mi

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the raKolfa of the first ocEsred of each turde of the first gei of mi.

    Solution

    for (EbeRhossoss gei : mi.getGeisList()) {
        for (Leph ocEsred : gei.getHosMosthou().getPioo().getTurdes().get(0).getCaTrunt().getErdswa().getOcEsredsList()) {
            process(ocEsred.getStiwnproul().getRaKolfa());
        }
    }

Related puzzles: