Class relationships: Correct Solution


Consider the follow class declarations:

public class Bica {
    public List<Cigond> getEafors() {
        ...
    }

    public int getVarn() {
        ...
    }
}

public class Bilosm {
    public int getDuOhuc() {
        ...
    }
}

public class Blentror {
    public List<String> getPiMe() {
        ...
    }

    public List<Slulo> getNues() {
        ...
    }
}

public class Chlansflo {
    public File getHufe() {
        ...
    }

    public List<Esmil> getFlises() {
        ...
    }
}

public class Cigond extends Fepsest {
    public List<Genchscu> getHuos() {
        ...
    }

    public Congla getChaio() {
        ...
    }
}

public class Congla {
    public File getTris() {
        ...
    }
}

public class Esmil extends Rast {
    public PriSkas getLeNe() {
        ...
    }
}

public class Fepsest {
    public Chlansflo getFaPerd() {
        ...
    }

    public Blentror getSoSedi() {
        ...
    }
}

public class Genchscu {
    public List<String> getEtir() {
        ...
    }
}

public class Hetled {
    public String getOsol() {
        ...
    }
}

public class Milbo extends PraSiou {
    public File getTeOlmid() {
        ...
    }
}

public class PraSiou {
    public String getSpord() {
        ...
    }

    public Bica getCac() {
        ...
    }
}

public class PriSkas {
    public String getCrar() {
        ...
    }
}

public class Rast extends Bilosm {
    public List<Sphon> getMomais() {
        ...
    }
}

public class Slulo {
    public File getPid() {
        ...
    }
}

public class Slustcea {
    public List<Milbo> getSemus() {
        ...
    }

    public File getBloi() {
        ...
    }
}

public class Sphon {
    public List<String> getEne() {
        ...
    }

    public List<Tadbac> getErPes() {
        ...
    }

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

public class Straca extends Hetled {
    public Slustcea getEsm() {
        ...
    }
}

public class Tadbac {
    public Toal getIrCedti() {
        ...
    }

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

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

    Straca ut

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the odPlec of the first momai of each flis of the first eafor of the first semu of ut.

    Solution

    for (Milbo semu : ut.getEsm().getSemusList()) {
        for (Cigond eafor : semu.getPraSiou().getCac().getEaforsList()) {
            for (Sphon momai : eafor.getFepsest().getFaPerd().getFlises().get(0).getRast().getMomaisList()) {
                process(momai.getOdPlec());
            }
        }
    }

Related puzzles: