Class relationships: Correct Solution


Consider the follow class declarations:

public class Atio {
    public File getUtHe() {
        ...
    }

    public Enmio getNacal() {
        ...
    }
}

public class Chadu {
    public int getBir() {
        ...
    }
}

public class Chea extends Atio {
    public Qess getFeMio() {
        ...
    }

    public List<Tamausm> getPaEsengs() {
        ...
    }
}

public class Couunt {
    public String getTuion() {
        ...
    }

    public List<Chea> getElvas() {
        ...
    }
}

public class CuaPhlodcir {
    public List<String> getCemad() {
        ...
    }
}

public class Dena {
    public Pren getSnund() {
        ...
    }

    public List<Whiou> getArgeses() {
        ...
    }
}

public class Docnoa extends SasAtshrir {
    public int getIdRihu() {
        ...
    }
}

public class Dosm {
    public List<String> getEaEr() {
        ...
    }
}

public class Enmio extends Massspauc {
    public List<Spamiac> getHepras() {
        ...
    }
}

public class Flifer {
    public List<String> getRasm() {
        ...
    }
}

public class Masslis {
    public byte[] getPuc() {
        ...
    }

    public String getAncin() {
        ...
    }
}

public class Massspauc {
    public List<CuaPhlodcir> getEpres() {
        ...
    }

    public Mocpiass getEcCi() {
        ...
    }

    public List<Chadu> getDiTaulls() {
        ...
    }
}

public class Mocpiass extends Dosm {
    public List<Docnoa> getAnlacs() {
        ...
    }

    public Prampruon getDio() {
        ...
    }
}

public class Prampruon {
    public List<String> getOcod() {
        ...
    }
}

public class Pren {
    public String getSaCer() {
        ...
    }
}

public class Qess {
    public File getBism() {
        ...
    }
}

public class SasAtshrir {
    public Dena getAqer() {
        ...
    }

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

public class Spamiac {
    public String getDuren() {
        ...
    }

    public Flifer getSeSost() {
        ...
    }
}

public class Tamausm {
    public String getNent() {
        ...
    }
}

public class Whiou extends Masslis {
    public int getOss() {
        ...
    }
}
  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:

    Couunt olde

    ...and the following method:

    public void process(String item)

    ...write code to process the ancin of the first arges of the first anlac of each elva of olde.

    Solution

    for (Docnoa anlac : olde.getElvas().get(0).getAtio().getNacal().getMassspauc().getEcCi().getAnlacsList()) {
        for (Whiou arges : anlac.getSasAtshrir().getAqer().getArgesesList()) {
            process(arges.getMasslis().getAncin());
        }
    }

Related puzzles: