Class relationships: Correct Solution


Consider the follow class declarations:

public class AngPhasmil {
    public String getScor() {
        ...
    }
}

public class Dant {
    public int getEsPreum() {
        ...
    }

    public Stentsqoss getNac() {
        ...
    }
}

public class Iandpor {
    public int getMolca() {
        ...
    }
}

public class Iosci {
    public List<String> getCicen() {
        ...
    }

    public Speng getMie() {
        ...
    }
}

public class Napipt {
    public File getPrel() {
        ...
    }

    public AngPhasmil getGogin() {
        ...
    }
}

public class PraThre {
    public File getAsmin() {
        ...
    }

    public List<Presm> getMisms() {
        ...
    }

    public int getHanra() {
        ...
    }
}

public class Presm extends Napipt {
    public Iandpor getSqe() {
        ...
    }
}

public class Rhir {
    public List<Dant> getSenles() {
        ...
    }

    public File getLiPrian() {
        ...
    }
}

public class ScoNeus extends PraThre {
    public File getDaol() {
        ...
    }
}

public class Speng {
    public String getGival() {
        ...
    }

    public List<ScoNeus> getPhes() {
        ...
    }
}

public class Stentsqoss extends Iosci {
    public List<Tisti> getEuns() {
        ...
    }
}

public class Tisti {
    public byte[] getFing() {
        ...
    }
}
  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:

    Rhir ai

    ...and the following method:

    public void process(int item)

    ...write code to process the hanra of each phe of the first senle of ai.

    Solution

    for (Dant senle : ai.getSenlesList()) {
        process(senle.getNac().getIosci().getMie().getPhes().get(0).getPraThre().getHanra());
    }

Related puzzles: