Class relationships: Correct Solution


Consider the follow class declarations:

public class Cedxen {
    public List<String> getDaan() {
        ...
    }
}

public class Coungmas {
    public List<Faube> getStins() {
        ...
    }

    public File getDiFaliw() {
        ...
    }
}

public class Cude extends Inxot {
    public File getCoErlel() {
        ...
    }
}

public class Dedor {
    public List<String> getLeMers() {
        ...
    }
}

public class Faube {
    public String getTeDeaw() {
        ...
    }
}

public class Frolso extends Sada {
    public List<String> getPispu() {
        ...
    }
}

public class Hergod {
    public List<String> getSliro() {
        ...
    }
}

public class Ingri {
    public List<Cedxen> getKnios() {
        ...
    }

    public List<Frolso> getPraps() {
        ...
    }
}

public class Inxot {
    public List<Swasko> getVaDaecs() {
        ...
    }

    public File getRauta() {
        ...
    }
}

public class Ponji {
    public List<String> getVed() {
        ...
    }
}

public class Prea {
    public File getCio() {
        ...
    }
}

public class Rhedhon {
    public Shentma getCecre() {
        ...
    }

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

public class Sada {
    public Ponji getCinea() {
        ...
    }

    public Cude getPran() {
        ...
    }
}

public class Shentma extends Coungmas {
    public List<Wheuctcril> getOmes() {
        ...
    }

    public Dedor getSpo() {
        ...
    }
}

public class Swasko {
    public Rhedhon getChoor() {
        ...
    }

    public File getHeTru() {
        ...
    }
}

public class Wheuctcril extends Hergod {
    public Prea getEnUstec() {
        ...
    }

    public int getDed() {
        ...
    }
}
  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:

    Ingri esos

    ...and the following method:

    public void process(int item)

    ...write code to process the ded of each ome of the first vaDaec of each prap of esos.

    Solution

    for (Swasko vaDaec : esos.getPraps().get(0).getSada().getPran().getInxot().getVaDaecsList()) {
        process(vaDaec.getChoor().getCecre().getOmes().get(0).getDed());
    }

Related puzzles: