Class relationships: Correct Solution


Consider the follow class declarations:

public class Assra extends TreEsnan {
    public int getOiMolna() {
        ...
    }
}

public class Bepin {
    public byte[] getMaMii() {
        ...
    }
}

public class Blusm extends Nism {
    public byte[] getModco() {
        ...
    }
}

public class Brerhio {
    public Scigci getLolch() {
        ...
    }

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

public class Criouiss {
    public byte[] getAnRe() {
        ...
    }
}

public class Cront {
    public File getSopa() {
        ...
    }
}

public class Drecci extends Brerhio {
    public Ianta getWaSliss() {
        ...
    }
}

public class Henggi {
    public Prankret getDiSpeda() {
        ...
    }

    public Secen getAceng() {
        ...
    }

    public List<Scheciont> getIaAis() {
        ...
    }
}

public class Ianta {
    public int getInum() {
        ...
    }
}

public class Meacpis {
    public int getPruc() {
        ...
    }
}

public class MicPante {
    public List<String> getLalis() {
        ...
    }
}

public class Nism {
    public List<Henggi> getIols() {
        ...
    }

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

public class Poung {
    public byte[] getMarhi() {
        ...
    }

    public List<Drecci> getCeads() {
        ...
    }
}

public class Prankret {
    public List<Assra> getFanchs() {
        ...
    }

    public File getOsan() {
        ...
    }
}

public class Pruapin extends Rianso {
    public int getOrHalen() {
        ...
    }
}

public class Pruer {
    public List<String> getHac() {
        ...
    }
}

public class Rianso {
    public Ropsad getVeBre() {
        ...
    }

    public Blusm getSaing() {
        ...
    }
}

public class Ropsad extends MicPante {
    public List<Cront> getNases() {
        ...
    }

    public List<Pruer> getEzens() {
        ...
    }
}

public class Sawnbou {
    public int getTeent() {
        ...
    }

    public List<Pruapin> getEclers() {
        ...
    }
}

public class Scheciont {
    public File getHio() {
        ...
    }

    public List<Bepin> getCiIrs() {
        ...
    }
}

public class Scigci extends Tworhatch {
    public String getKicin() {
        ...
    }

    public File getOor() {
        ...
    }
}

public class Secen extends Meacpis {
    public Criouiss getRean() {
        ...
    }
}

public class TreEsnan {
    public String getWoind() {
        ...
    }

    public Poung getTasmu() {
        ...
    }
}

public class Tworhatch {
    public File getMiimi() {
        ...
    }
}
  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:

    Sawnbou ri

    ...and the following method:

    public void process(File item)

    ...write code to process the oor of each cead of the first fanch of the first iol of the first ecler of ri.

    Solution

    for (Pruapin ecler : ri.getEclersList()) {
        for (Henggi iol : ecler.getRianso().getSaing().getNism().getIolsList()) {
            for (Assra fanch : iol.getDiSpeda().getFanchsList()) {
                process(fanch.getTreEsnan().getTasmu().getCeads().get(0).getBrerhio().getLolch().getOor());
            }
        }
    }

Related puzzles: