some code samples, various examples of simple modeling ideas and some minor algorithms.

Squares.java 264B

12345678910111213141516
  1. class Squares
  2. {
  3. // Print all square numbers up to a fixed limit
  4. static final int LIMIT=150;
  5. public void display(int limit)
  6. {
  7. int i;
  8. for(i=1;i*i<limit;i++)
  9. {
  10. System.out.print("The square of "+i);
  11. System.out.println(" is "+i*i);
  12. }
  13. }
  14. }