Class relationships: Correct Solution


Consider the follow class declarations:

public class Acurp {
    public File getPse() {
        ...
    }

    public List<Oasen> getEjas() {
        ...
    }
}

public class Alic extends Gastau {
    public byte[] getTacir() {
        ...
    }
}

public class Bidtre {
    public List<String> getIrce() {
        ...
    }

    public List<Hafiac> getLeCos() {
        ...
    }
}

public class CioLeha {
    public File getIdHa() {
        ...
    }

    public File getNolis() {
        ...
    }
}

public class Enen {
    public byte[] getChric() {
        ...
    }
}

public class Gastau {
    public List<String> getBiss() {
        ...
    }
}

public class Hafiac {
    public byte[] getRufa() {
        ...
    }
}

public class Hionin {
    public String getCaPson() {
        ...
    }

    public List<Raos> getBaAlleses() {
        ...
    }
}

public class Isud {
    public String getAplu() {
        ...
    }

    public Roddre getAtch() {
        ...
    }
}

public class Lawnwe {
    public List<String> getFal() {
        ...
    }
}

public class Leras extends CioLeha {
    public File getOspo() {
        ...
    }
}

public class Michscroun {
    public String getKudod() {
        ...
    }
}

public class Mormiang {
    public String getBiEnge() {
        ...
    }
}

public class Mossdo {
    public Pliiact getAnCios() {
        ...
    }

    public String getEtHotil() {
        ...
    }
}

public class Murli {
    public List<String> getAwdir() {
        ...
    }
}

public class Oasen extends Mossdo {
    public Murli getFaac() {
        ...
    }
}

public class Onpass extends Lawnwe {
    public List<Mormiang> getSucs() {
        ...
    }

    public List<Alic> getWions() {
        ...
    }
}

public class Pliiact extends Skess {
    public Wutka getTiWio() {
        ...
    }

    public Bidtre getUass() {
        ...
    }
}

public class Psio {
    public Enen getOsom() {
        ...
    }

    public Leras getUdas() {
        ...
    }
}

public class Raos extends Isud {
    public byte[] getIocri() {
        ...
    }
}

public class Roddre extends Onpass {
    public List<Michscroun> getHalcus() {
        ...
    }

    public List<Psio> getErIsqes() {
        ...
    }
}

public class Seungdi {
    public String getOus() {
        ...
    }

    public Hionin getVoasm() {
        ...
    }
}

public class Skess {
    public byte[] getIiVo() {
        ...
    }

    public List<Seungdi> getElhofs() {
        ...
    }
}

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

    Acurp eun

    ...and the following method:

    public void process(File item)

    ...write code to process the nolis of each erIsqe of the first baAlles of the first elhof of each eja of eun.

    Solution

    for (Seungdi elhof : eun.getEjas().get(0).getMossdo().getAnCios().getSkess().getElhofsList()) {
        for (Raos baAlles : elhof.getVoasm().getBaAllesesList()) {
            process(baAlles.getIsud().getAtch().getErIsqes().get(0).getUdas().getCioLeha().getNolis());
        }
    }

Related puzzles: