Class relationships: Correct Solution


Consider the follow class declarations:

public class Alcoi {
    public List<Slessand> getAwuses() {
        ...
    }

    public byte[] getOpho() {
        ...
    }
}

public class Bleos {
    public byte[] getMeFasno() {
        ...
    }

    public Edston getViUngqi() {
        ...
    }
}

public class Brelac {
    public List<String> getErot() {
        ...
    }
}

public class Casssa {
    public File getSios() {
        ...
    }
}

public class Doism extends IabPhapa {
    public Zoor getAmErmin() {
        ...
    }

    public List<Trangsuk> getChirs() {
        ...
    }

    public Stermpreng getLeCed() {
        ...
    }
}

public class Dorto {
    public List<String> getMich() {
        ...
    }
}

public class Ecpas {
    public List<Pives> getVesals() {
        ...
    }

    public byte[] getMerve() {
        ...
    }
}

public class Edston {
    public File getHiash() {
        ...
    }

    public List<Icko> getRidops() {
        ...
    }
}

public class Elhun extends Casssa {
    public Molhi getPiagi() {
        ...
    }
}

public class Girthhen {
    public List<Ocmist> getPlels() {
        ...
    }

    public Brelac getWuac() {
        ...
    }
}

public class IabPhapa {
    public File getCesu() {
        ...
    }
}

public class Icko extends Girthhen {
    public Ecpas getCoUn() {
        ...
    }
}

public class Molhi {
    public String getKaTonro() {
        ...
    }

    public File getProro() {
        ...
    }
}

public class Neid {
    public String getNaKe() {
        ...
    }
}

public class Ocmist {
    public File getLapa() {
        ...
    }

    public Ruess getOnUdpe() {
        ...
    }
}

public class Pives {
    public String getErEtunt() {
        ...
    }
}

public class Ruess extends Doism {
    public List<Tant> getNacs() {
        ...
    }

    public List<Dorto> getPluls() {
        ...
    }

    public Neid getThrii() {
        ...
    }
}

public class Semiss {
    public List<Elhun> getSaProls() {
        ...
    }

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

public class Slessand extends Semiss {
    public File getCri() {
        ...
    }
}

public class Stermpreng extends Alcoi {
    public List<String> getHabec() {
        ...
    }
}

public class Tant {
    public int getIkIn() {
        ...
    }
}

public class Teuse {
    public int getEnir() {
        ...
    }
}

public class Trangsuk {
    public File getLiRe() {
        ...
    }
}

public class Zoor extends Teuse {
    public File getBiche() {
        ...
    }
}
  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:

    Bleos hiul

    ...and the following method:

    public void process(File item)

    ...write code to process the proro of the first saProl of the first awus of each plel of the first ridop of hiul.

    Solution

    for (Icko ridop : hiul.getViUngqi().getRidopsList()) {
        for (Slessand awus : ridop.getGirthhen().getPlels().get(0).getOnUdpe().getDoism().getLeCed().getAlcoi().getAwusesList()) {
            for (Elhun saProl : awus.getSemiss().getSaProlsList()) {
                process(saProl.getPiagi().getProro());
            }
        }
    }

Related puzzles: