Class relationships: Correct Solution


Consider the follow class declarations:

public class Ashon {
    public String getScu() {
        ...
    }
}

public class BofPreaeper {
    public List<Diot> getOlPopris() {
        ...
    }

    public List<Nomrid> getPosks() {
        ...
    }
}

public class Chent {
    public int getIss() {
        ...
    }
}

public class Cionkro {
    public List<String> getSeMipal() {
        ...
    }

    public Serk getXaPova() {
        ...
    }
}

public class Dibratch {
    public List<String> getCrihu() {
        ...
    }

    public Litri getOnPlol() {
        ...
    }
}

public class Diot {
    public File getPinca() {
        ...
    }
}

public class Gulce {
    public File getSto() {
        ...
    }
}

public class Horberm extends Trossnoos {
    public List<Chent> getIeIens() {
        ...
    }
}

public class Iouc extends Strephlug {
    public Sphekad getNiwu() {
        ...
    }
}

public class Licpral {
    public byte[] getAned() {
        ...
    }

    public Wantstrid getPrutu() {
        ...
    }
}

public class Litri {
    public List<String> getToNune() {
        ...
    }
}

public class Matroust {
    public Sapsced getMusm() {
        ...
    }

    public String getEuvo() {
        ...
    }
}

public class Nashe extends Sheac {
    public Ashon getUmi() {
        ...
    }

    public List<Gulce> getEdods() {
        ...
    }
}

public class Nomrid {
    public List<Matroust> getRiSnis() {
        ...
    }

    public Horberm getEtFe() {
        ...
    }
}

public class Passsnart {
    public byte[] getLaNisil() {
        ...
    }
}

public class Piod {
    public int getBidce() {
        ...
    }
}

public class Sapsced {
    public File getPiser() {
        ...
    }
}

public class Serk extends TruOlont {
    public List<Piod> getKioses() {
        ...
    }

    public Dibratch getPosan() {
        ...
    }
}

public class Sheac {
    public String getUnIcun() {
        ...
    }

    public File getEgil() {
        ...
    }
}

public class Sphekad {
    public int getOsud() {
        ...
    }

    public List<Licpral> getSosses() {
        ...
    }
}

public class Strephlug {
    public File getMiada() {
        ...
    }
}

public class Trossnoos {
    public File getIssi() {
        ...
    }

    public List<Cionkro> getOdSches() {
        ...
    }
}

public class TruOlont extends Iouc {
    public byte[] getSoDe() {
        ...
    }
}

public class Wantstrid extends Passsnart {
    public List<Nashe> getPoects() {
        ...
    }
}
  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:

    BofPreaeper seng

    ...and the following method:

    public void process(File item)

    ...write code to process the egil of the first poect of the first sosse of each odSche of each posk of seng.

    Solution

    for (Licpral sosse : seng.getPosks().get(0).getEtFe().getTrossnoos().getOdSches().get(0).getXaPova().getTruOlont().getIouc().getNiwu().getSossesList()) {
        for (Nashe poect : sosse.getPrutu().getPoectsList()) {
            process(poect.getSheac().getEgil());
        }
    }

Related puzzles: