public class FleetOfDyads BEGIN Dyad[] fleetMembers // declare fleetMembers as an array of Ball integer total = 5 // Max number of squares in fleet FleetOfDyads() // Constructor BEGIN fleetMembers = new Dyad[total] // create an empty array with 5 "locations" FOR (integer i = 0, i < total, i = i + 1) // loop: carry on whilst i is less than 5, add 1 each cycle fleetMembers[i] = new Dyad() // create a Ball object for location [i] in the array fleetMembers[i].setX (i * 10) // multiply i by 10, and pass this to the setX method fleetMembers[i].setY (i * 10) // multiply i by 10, and pass this to the setY method END-FOR END public void draw() BEGIN FOR (integer i = 0, i < total, i = i + 1) // loop: carry on whilst i is less than 5, add 1 each cycle fleetMembers[i].draw() // ask fleetMember[i] to draw itself END-FOR END public void goSouth(integer howFar) BEGIN FOR (integer i = 0 i < total i = i + 1) // loop: carry on whilst i is less than 5, add 1 each cycle // ask fleetMember[i] for its current Y position // then add howFar (howFar to go south) to it // then pass this to the setY method fleetMembers[i].setY (fleetMembers[i].getY() + howFar) END-FOR END END // end of class