Class relationships: Correct Solution


Consider the follow class declarations:

public class CacStrelro {
    public File getSaPa() {
        ...
    }

    public List<Pistruph> getAisses() {
        ...
    }
}

public class Crid {
    public File getGewa() {
        ...
    }

    public Rhesh getCipis() {
        ...
    }
}

public class Fedsi {
    public File getVec() {
        ...
    }
}

public class Felshun {
    public Seodiar getEnCic() {
        ...
    }

    public List<QisSedsi> getLoAdstes() {
        ...
    }
}

public class Idop {
    public int getSto() {
        ...
    }
}

public class Ikic {
    public List<String> getPrik() {
        ...
    }
}

public class Lesran extends Ikic {
    public List<RuiLenoght> getCrucs() {
        ...
    }
}

public class Pistruph extends Veencird {
    public List<Whedoush> getSpris() {
        ...
    }
}

public class Ptoass {
    public List<String> getDafra() {
        ...
    }

    public Felshun getCruss() {
        ...
    }
}

public class QisSedsi {
    public List<String> getCuOl() {
        ...
    }

    public File getFras() {
        ...
    }
}

public class Rhesh extends Lesran {
    public List<Vass> getFoapos() {
        ...
    }
}

public class RuiLenoght {
    public String getCio() {
        ...
    }
}

public class Seodiar {
    public List<String> getErNo() {
        ...
    }
}

public class Vass extends Ptoass {
    public Fedsi getTesal() {
        ...
    }
}

public class Veencird {
    public int getPrer() {
        ...
    }

    public Crid getCais() {
        ...
    }
}

public class Whedoush extends Idop {
    public List<String> getEdBoren() {
        ...
    }
}
  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:

    CacStrelro be

    ...and the following method:

    public void process(File item)

    ...write code to process the fras of the first loAdste of the first foapo of each aiss of be.

    Solution

    for (Vass foapo : be.getAisses().get(0).getVeencird().getCais().getCipis().getFoaposList()) {
        for (QisSedsi loAdste : foapo.getPtoass().getCruss().getLoAdstesList()) {
            process(loAdste.getFras());
        }
    }

Related puzzles: