Extra notes about Assignment 2 Last update: Fri 28 Jan 2011 16:10:15 EST Dear students, We will add clarifications and corrections to the A2 specification document as they come to our attention. Note: If your programs pass all the tests we supply in MutationTest and BatteryTest, you are not guaranteed full marks for the assignment: tests can prove the absence of specific bugs but they cannot prove the complete correctness of any program. ===== Warm-up Question 5 When we say that you should write empty methods to make a "skeleton" program, we mean, for example, that you should define isAtPowerStation() to just return 0, and nothing else. The same idea applies to the other methods in both classes. ===== Question 1 Clarification: The robot's square body is always parallel with the boundaries of the charging station. Clarification: "If a corner of the robot's square body touches a corner of the station, the method returns 0". In other words, the (x,y) coordinates of a robot-body corner are the same as the (x,y) coordinates of a station corner. Added a figure to the specification to illustrate this. Clarification: Touching a corner means *only* touching a corner. So the robot is not inside and it is corner to corner with the station (i.e. it is not touching an edge). Similarly, touching an edge means *only* touching an edge. The robot is not inside. Insignificant typo in the description of computeChargeRate(): "given a non-zero positive float representing the *weight* of a robot..." --> The specification for computeChargeRate mentions size all over the place, but if that is confusing to you, you can think of it as weight. It has nothing to do with the width or height of the robot body. When the specification says "round", use Math.round(). Clarification computeChargeRate(): "position" refers to the output of the isAtPowerStation() method. ===== Question 2 Clarification. All the operations in the Mutations class are *case-sensitive*. In other words, the character 'a' is not the same as the character 'A'. Clarification (for swapPair). If the value of i is too big or too small, the method returns the original String. For example, if s = abcdef and i = 5 then s should be abcdef (because String characters are numbered starting at 0 and swapping the last character with the character that follows it doesn't make sense -- there is no character following the last character). Clarification (for copySubsequence) The following rule takes priority over the other rules for "bad" values of a and b: "If a is greater than b the method returns an empty String (since there is nothing that is both to the right of a and to the left of b)." That is why the input ("x", 1, -1) will return the empty String rather than "x".