Class relationships: Correct Solution


Consider the follow class declarations:

public class Brasta extends Spicni {
    public Promar getLueng() {
        ...
    }
}

public class Celpse extends Spid {
    public int getSaEc() {
        ...
    }
}

public class Inpeess {
    public List<Recom> getNadeses() {
        ...
    }

    public List<Brasta> getOspis() {
        ...
    }
}

public class NocBarsqe {
    public Inpeess getAnCo() {
        ...
    }

    public List<PraSnardra> getUnBaiads() {
        ...
    }
}

public class Oidsil {
    public String getBrich() {
        ...
    }
}

public class PraSnardra {
    public int getSonus() {
        ...
    }
}

public class Prabra {
    public List<String> getHajec() {
        ...
    }
}

public class Pric extends NocBarsqe {
    public Oidsil getBita() {
        ...
    }
}

public class Promar {
    public List<Celpse> getTeOcs() {
        ...
    }

    public String getChema() {
        ...
    }
}

public class Recom {
    public byte[] getPlo() {
        ...
    }
}

public class Spicni {
    public String getBism() {
        ...
    }
}

public class Spid {
    public String getOnsi() {
        ...
    }

    public Prabra getEack() {
        ...
    }

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

    Pric scre

    ...and the following method:

    public void process(File item)

    ...write code to process the nosti of each teOc of each ospi of scre.

    Solution

    process(scre.getNocBarsqe().getAnCo().getOspis().get(0).getLueng().getTeOcs().get(0).getSpid().getNosti());

Related puzzles: