Talk:Hackety Hacking Problem AreaofN SidedPolygon Methods

From OLPC
Jump to navigation Jump to search

A few points:

  • The sample output is wrong; the area of a square with side 2 is 4.
  • The problem statement does not make it clear why it is necessary to define a method. Defining a method only to call it immediately (and never again) unnecessarily complicates the solution.
  • You use the letter "l" as a parameter name; in most typefaces this letter is hard to distinguish from the number 1, which you also use in the function.
  • The method calculates the area using the "l" parameter, but prints using the global "L" variable.

Joe 16:47, 16 October 2007 (EDT)