07-07feb13stepwiseRefinement

This definition of s and k is very important this

This preview shows page 2 out of 2 pages.

This definition of s and k is very important. This definition will drive the development. Whenever we append something to s, we have to change k to keep the definition true. The definition helps us develop the method body and helps the reader understand it. You are expected to study section 13.4! Whenever you declare a local variable whose value will change often over execution of the method, write a comment near its declaration to define it !! You will use the definition often as you develop the method. Without the definition, you will forget what the variable means and will make mistakes. 10 Anglicizing an integer /** = the English equivalent of n, for 1 <= n < 1,000 e.g. ang(3) is “three” ang(641) is “six hundred forty one” */ public static String ang( int n) { // ang(n) is s + ang(k) String s= “”; int k= n; } The rest of this lecture is devoted to the development of a different algorithm for anglicizing an integer —or rather the same algorithm but expressed entirely differently, using DrJava. The final program will be on the course website.
Image of page 2
You've reached the end of this preview.
  • Spring '07
  • DAVIDGRIES

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern