Class relationships: Correct Solution


Consider the follow class declarations:

public class Asfat extends Enda {
    public byte[] getOrk() {
        ...
    }
}

public class Baleng {
    public Doned getUnme() {
        ...
    }

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

public class BilCucel {
    public byte[] getIcTa() {
        ...
    }
}

public class Chraiszus {
    public List<Whire> getCrases() {
        ...
    }

    public String getUaApi() {
        ...
    }
}

public class Cless extends Baleng {
    public byte[] getAnHoro() {
        ...
    }
}

public class Cosmcia {
    public int getDrin() {
        ...
    }
}

public class Docte {
    public List<SpePhang> getSlols() {
        ...
    }

    public File getFuli() {
        ...
    }
}

public class Doned {
    public Cosmcia getNeng() {
        ...
    }

    public List<Asfat> getDobos() {
        ...
    }
}

public class Enda extends Ponfil {
    public File getCer() {
        ...
    }
}

public class Fotes {
    public List<String> getEngat() {
        ...
    }
}

public class Idlo {
    public List<String> getArSti() {
        ...
    }
}

public class Irong {
    public List<UrtLanon> getLisirs() {
        ...
    }

    public List<Sentast> getMeists() {
        ...
    }

    public Thint getGir() {
        ...
    }
}

public class Lawil {
    public byte[] getSpand() {
        ...
    }

    public int getUli() {
        ...
    }
}

public class Ponfil {
    public List<Fotes> getTefobs() {
        ...
    }

    public Chraiszus getLehic() {
        ...
    }

    public Irong getEril() {
        ...
    }
}

public class Sentast {
    public List<String> getBlod() {
        ...
    }

    public BilCucel getUos() {
        ...
    }
}

public class SpePhang {
    public Cless getOrre() {
        ...
    }

    public int getHass() {
        ...
    }
}

public class Sutresm {
    public int getAmsus() {
        ...
    }
}

public class Thint extends Idlo {
    public List<String> getBiss() {
        ...
    }
}

public class UrtLanon extends Sutresm {
    public List<Lawil> getCledos() {
        ...
    }
}

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

    Docte oss

    ...and the following method:

    public void process(int item)

    ...write code to process the uli of each cledo of each lisir of the first dobo of the first slol of oss.

    Solution

    for (SpePhang slol : oss.getSlolsList()) {
        for (Asfat dobo : slol.getOrre().getBaleng().getUnme().getDobosList()) {
            process(dobo.getEnda().getPonfil().getEril().getLisirs().get(0).getCledos().get(0).getUli());
        }
    }

Related puzzles: