Class relationships: Correct Solution


Consider the follow class declarations:

public class AedDoar {
    public String getNel() {
        ...
    }

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

public class Ahosm extends Nedrang {
    public List<DraUift> getDeogas() {
        ...
    }
}

public class Crotglet {
    public List<String> getBiad() {
        ...
    }
}

public class Dall {
    public int getIngor() {
        ...
    }

    public AedDoar getUnWeul() {
        ...
    }
}

public class DraUift {
    public String getPade() {
        ...
    }
}

public class Ecbass {
    public List<String> getSidal() {
        ...
    }
}

public class Eedu extends Erlhol {
    public List<Whimi> getNaTegis() {
        ...
    }

    public Usse getIrEmang() {
        ...
    }
}

public class Erdi {
    public Spraf getEkCec() {
        ...
    }

    public List<Dall> getMousts() {
        ...
    }

    public Fliocel getCous() {
        ...
    }
}

public class Erlhol {
    public File getOrAi() {
        ...
    }
}

public class Fassist extends Sengliar {
    public List<Ecbass> getPris() {
        ...
    }
}

public class Fliocel {
    public List<String> getIhar() {
        ...
    }
}

public class Holgio {
    public Ahosm getPiMe() {
        ...
    }

    public int getEue() {
        ...
    }
}

public class Nedrang extends Erdi {
    public int getOnBeeng() {
        ...
    }
}

public class Ondeng {
    public File getMomen() {
        ...
    }
}

public class Sengliar {
    public List<Holgio> getGiushs() {
        ...
    }

    public Ondeng getUlglu() {
        ...
    }
}

public class Spraf {
    public List<String> getIcas() {
        ...
    }
}

public class Usse extends Crotglet {
    public List<Fassist> getIsas() {
        ...
    }
}

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

    Eedu o

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the prot of each moust of the first giush of the first isa of o.

    Solution

    for (Fassist isa : o.getIrEmang().getIsasList()) {
        for (Holgio giush : isa.getSengliar().getGiushsList()) {
            process(giush.getPiMe().getNedrang().getErdi().getMousts().get(0).getUnWeul().getProt());
        }
    }

Related puzzles: