Introduction to Programming: Additional work for week 4

Last year in Introduction to Programming, the concept of loops was introduced using programs for reading in numbers and calculating averages. Although we have introduced loops using the Ship from David Barnes' book this year, the notes on averages available here are still very relevant, and the example code still available. So you should read these notes and experiment with the code. You should also read the material in your textbook(s) on while loops. Remember that different textbooks introduce material on programming in different orders, so you may find the section on while loops comes after other material on aspects of programming with Java that we haven't covered yet. Any site on the web which introduces Java will have a section on loops in Java (though often selection statement using if are introduced first). Here's a few examples of suitable further reading:

The term aliasing for the way that two variables can refer to the same object in Java is not always used in textbooks, but it's an important concept even if not always given that name. You can find "aliasing" in the index of the Barnes textbook. But the idea is explained (though not given that name) in section 3.8 (page 126) of the Horstmann textbook. Some slides on object concepts, such as aliasing, produced at Yale University can be found here.

Matthew Huntbach
17th October 2000