Class relationships: Correct Solution


Consider the follow class declarations:

public class Aesshand {
    public String getNort() {
        ...
    }

    public Vasmpirt getCaMe() {
        ...
    }
}

public class Anslon {
    public String getUnt() {
        ...
    }
}

public class Fesspeff {
    public File getIhosh() {
        ...
    }
}

public class Hiarmi {
    public Anslon getAoSo() {
        ...
    }

    public List<Vuda> getHoTus() {
        ...
    }
}

public class Hocme extends KacSpess {
    public List<Fesspeff> getFions() {
        ...
    }

    public Qiadid getEhit() {
        ...
    }
}

public class KacSpess {
    public int getUiSe() {
        ...
    }

    public List<Phugn> getUcres() {
        ...
    }
}

public class Meusress {
    public int getRal() {
        ...
    }
}

public class Phugn {
    public int getLadad() {
        ...
    }
}

public class Qiadid {
    public List<String> getEsm() {
        ...
    }

    public List<Tothsu> getKnos() {
        ...
    }
}

public class Ralpend {
    public byte[] getNenma() {
        ...
    }
}

public class Stei {
    public File getTeuss() {
        ...
    }

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

public class Tothsu {
    public Stei getRoOnta() {
        ...
    }

    public int getQia() {
        ...
    }
}

public class Vasmpirt extends Hocme {
    public Ralpend getThom() {
        ...
    }
}

public class Vuda extends Aesshand {
    public List<Meusress> getPhes() {
        ...
    }
}
  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:

    Hiarmi lold

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the cusm of the first kno of each hoTu of lold.

    Solution

    for (Tothsu kno : lold.getHoTus().get(0).getAesshand().getCaMe().getHocme().getEhit().getKnosList()) {
        process(kno.getRoOnta().getCusm());
    }

Related puzzles: