Class relationships: Correct Solution


Consider the follow class declarations:

public class Badplel extends Sorchi {
    public int getTedxu() {
        ...
    }
}

public class Barmdag {
    public byte[] getPse() {
        ...
    }
}

public class Brorf {
    public int getHoStul() {
        ...
    }
}

public class Ciplea {
    public List<Stanouss> getErToors() {
        ...
    }

    public Doudmic getPaiss() {
        ...
    }
}

public class Datio extends Zodroud {
    public Kuro getFaBama() {
        ...
    }
}

public class Dosdoc extends Pena {
    public Brorf getBeSpeff() {
        ...
    }
}

public class Doudmic {
    public File getUnlou() {
        ...
    }
}

public class Kuro {
    public List<Dosdoc> getChecs() {
        ...
    }

    public File getSoSauss() {
        ...
    }
}

public class MecSwestrir extends Thoca {
    public String getAcAr() {
        ...
    }
}

public class Pena extends MecSwestrir {
    public Badplel getSas() {
        ...
    }
}

public class Sorchi {
    public List<Barmdag> getAeRas() {
        ...
    }

    public List<Ciplea> getOuses() {
        ...
    }
}

public class Stanouss {
    public File getEnCe() {
        ...
    }

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

public class Thoca {
    public int getBecku() {
        ...
    }
}

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

    Datio is

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the heang of the first erToor of each ous of the first chec of is.

    Solution

    for (Dosdoc chec : is.getFaBama().getChecsList()) {
        for (Stanouss erToor : chec.getPena().getSas().getSorchi().getOuses().get(0).getErToorsList()) {
            process(erToor.getHeang());
        }
    }

Related puzzles: