Class relationships: Correct Solution


Consider the follow class declarations:

public class Bansen {
    public int getRau() {
        ...
    }
}

public class Boshro {
    public List<Marlang> getKnises() {
        ...
    }

    public Scramel getLiAe() {
        ...
    }
}

public class Diho {
    public Usthre getMatro() {
        ...
    }

    public Tion getOon() {
        ...
    }
}

public class Elpe {
    public File getJor() {
        ...
    }
}

public class Hodi extends Odri {
    public WepHoasow getMift() {
        ...
    }
}

public class Hota {
    public List<String> getFicpo() {
        ...
    }
}

public class Marlang extends Hota {
    public List<Elpe> getRuswes() {
        ...
    }
}

public class MavMul {
    public File getSpu() {
        ...
    }
}

public class Nechtoc {
    public byte[] getOdTouen() {
        ...
    }
}

public class Neir {
    public List<Uclax> getRolirs() {
        ...
    }

    public Bansen getWhe() {
        ...
    }
}

public class Odri {
    public String getEring() {
        ...
    }
}

public class Proloc extends Hodi {
    public byte[] getCleph() {
        ...
    }
}

public class PucRedul {
    public int getQir() {
        ...
    }
}

public class QudPasiss extends Diho {
    public List<Nechtoc> getTipeses() {
        ...
    }
}

public class Reng extends Ston {
    public List<Boshro> getIdTenos() {
        ...
    }
}

public class Santuash {
    public List<String> getDiSeess() {
        ...
    }

    public List<Proloc> getVeses() {
        ...
    }
}

public class Scramel extends Neir {
    public String getHeun() {
        ...
    }
}

public class Smoint {
    public QudPasiss getNalbo() {
        ...
    }

    public File getNerg() {
        ...
    }
}

public class Ston {
    public PucRedul getSclo() {
        ...
    }

    public Vess getDasmo() {
        ...
    }
}

public class Tion {
    public File getAmMo() {
        ...
    }
}

public class Uclax {
    public File getIsJid() {
        ...
    }

    public File getSper() {
        ...
    }
}

public class Usthre extends Reng {
    public String getPlagn() {
        ...
    }
}

public class Vess {
    public String getGea() {
        ...
    }
}

public class WepHoasow {
    public List<Smoint> getSenhas() {
        ...
    }

    public List<MavMul> getGlases() {
        ...
    }
}
  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:

    Santuash es

    ...and the following method:

    public void process(File item)

    ...write code to process the sper of each rolir of the first idTeno of the first senha of the first ves of es.

    Solution

    for (Proloc ves : es.getVesesList()) {
        for (Smoint senha : ves.getHodi().getMift().getSenhasList()) {
            for (Boshro idTeno : senha.getNalbo().getDiho().getMatro().getReng().getIdTenosList()) {
                process(idTeno.getLiAe().getNeir().getRolirs().get(0).getSper());
            }
        }
    }

Related puzzles: