Class relationships: Correct Solution


Consider the follow class declarations:

public class Bestpu extends Hogreng {
    public File getCeon() {
        ...
    }
}

public class Cestra {
    public List<String> getMeAn() {
        ...
    }

    public List<Kressmir> getRenats() {
        ...
    }
}

public class Chemron {
    public List<String> getRoBict() {
        ...
    }
}

public class Docrong {
    public List<String> getIrSeu() {
        ...
    }
}

public class GleHarcar {
    public byte[] getRaPront() {
        ...
    }
}

public class Gnue {
    public Cestra getCeer() {
        ...
    }

    public Bestpu getSengo() {
        ...
    }
}

public class Hogreng {
    public File getMuCael() {
        ...
    }
}

public class Kressmir extends Shregent {
    public Docrong getSelde() {
        ...
    }
}

public class Mepla {
    public Psaa getDio() {
        ...
    }

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

public class OthStass {
    public Sioth getIrpan() {
        ...
    }

    public String getTio() {
        ...
    }
}

public class Psaa extends GleHarcar {
    public List<Tosot> getFiResms() {
        ...
    }

    public List<Chemron> getHosbos() {
        ...
    }
}

public class Sefros {
    public List<OthStass> getIsses() {
        ...
    }

    public List<Urflul> getBres() {
        ...
    }
}

public class Shregent extends Sefros {
    public List<Werflugn> getKros() {
        ...
    }
}

public class Sioth extends Mepla {
    public int getSpith() {
        ...
    }
}

public class Tosot {
    public List<String> getPejeo() {
        ...
    }

    public Viomu getCeass() {
        ...
    }

    public int getEppro() {
        ...
    }
}

public class Urflul {
    public byte[] getNosse() {
        ...
    }
}

public class Viomu {
    public File getBepet() {
        ...
    }
}

public class Werflugn {
    public List<String> getUdBaso() {
        ...
    }
}
  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:

    Gnue la

    ...and the following method:

    public void process(int item)

    ...write code to process the eppro of the first fiResm of each iss of the first renat of la.

    Solution

    for (Kressmir renat : la.getCeer().getRenatsList()) {
        for (Tosot fiResm : renat.getShregent().getSefros().getIsses().get(0).getIrpan().getMepla().getDio().getFiResmsList()) {
            process(fiResm.getEppro());
        }
    }

Related puzzles: