Class relationships: Correct Solution


Consider the follow class declarations:

public class AcaVam {
    public List<String> getOdess() {
        ...
    }

    public int getIsi() {
        ...
    }
}

public class Amee extends Scricstan {
    public byte[] getScank() {
        ...
    }
}

public class Beges {
    public int getSiwn() {
        ...
    }
}

public class Bempi {
    public List<Morje> getOths() {
        ...
    }

    public List<Heuen> getSafas() {
        ...
    }
}

public class Cetsza {
    public File getUnk() {
        ...
    }
}

public class Heldiass {
    public Ongsid getAcBre() {
        ...
    }

    public File getPeEend() {
        ...
    }
}

public class Heuen extends Macslil {
    public File getGiEsm() {
        ...
    }
}

public class Macslil {
    public byte[] getHodmo() {
        ...
    }
}

public class Morje {
    public int getSust() {
        ...
    }
}

public class Nung {
    public Amee getNurm() {
        ...
    }

    public int getProu() {
        ...
    }
}

public class Ongsid extends Threr {
    public List<Cetsza> getPruses() {
        ...
    }

    public Beges getCus() {
        ...
    }

    public Bempi getReter() {
        ...
    }
}

public class Scricstan extends AcaVam {
    public int getGlan() {
        ...
    }
}

public class Threr {
    public List<String> getFoa() {
        ...
    }

    public List<Nung> getOrQafes() {
        ...
    }
}

public class Trelder {
    public String getSte() {
        ...
    }

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

    Trelder brus

    ...and the following method:

    public void process(int item)

    ...write code to process the isi of each orQafe of the first olres of brus.

    Solution

    for (Heldiass olres : brus.getOlresesList()) {
        process(olres.getAcBre().getThrer().getOrQafes().get(0).getNurm().getScricstan().getAcaVam().getIsi());
    }

Related puzzles: