Class relationships: Correct Solution


Consider the follow class declarations:

public class Aswir {
    public File getFaWol() {
        ...
    }
}

public class Daess {
    public File getTraa() {
        ...
    }

    public List<Tilchast> getPruns() {
        ...
    }
}

public class Ertmer {
    public byte[] getFivi() {
        ...
    }
}

public class Gishi {
    public int getMeXotra() {
        ...
    }
}

public class Isve {
    public Sipui getHecia() {
        ...
    }

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

public class Phuspiss {
    public String getOdte() {
        ...
    }

    public List<Slerk> getVinis() {
        ...
    }
}

public class Qicji {
    public int getZipri() {
        ...
    }
}

public class Rhishplo {
    public Phuspiss getWalsa() {
        ...
    }

    public int getSodol() {
        ...
    }
}

public class Roupe {
    public Ertmer getSwian() {
        ...
    }

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

public class Sipui extends Qicji {
    public List<Udes> getPris() {
        ...
    }

    public List<Tangil> getBlengs() {
        ...
    }
}

public class Slerk extends Isve {
    public List<Roupe> getAsis() {
        ...
    }
}

public class Tangil {
    public Aswir getMedo() {
        ...
    }

    public File getCed() {
        ...
    }

    public File getVong() {
        ...
    }
}

public class Tilchast extends Rhishplo {
    public Gishi getGugon() {
        ...
    }
}

public class Udes {
    public File getIltri() {
        ...
    }
}
  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:

    Daess iaw

    ...and the following method:

    public void process(File item)

    ...write code to process the vong of each bleng of the first vini of each prun of iaw.

    Solution

    for (Slerk vini : iaw.getPruns().get(0).getRhishplo().getWalsa().getVinisList()) {
        process(vini.getIsve().getHecia().getBlengs().get(0).getVong());
    }

Related puzzles: