| Revised: 10/01/98; 08/04/99; 01/20/00; 03/30/00 |
CHAPTER 15 --- LoopsMany modern machines do their work using repeated motions, cycles. The engine in your car performs the same motions over and over again as it burns gasoline to provide power. Electric motors are similar; they convert electric power into spinning motion. Both of these machines are useful because they do the the same things over and over and can keep going as long as we want. Computer programs can have cycles within them, also. Much of the usefulness of modern computer software comes from doing things in cycles. In programing, cycles are called loops. When a program has a loop in it, some statements are done over and over as long as is needed to get the work done. Most computer programs (such as a game program or a wordprocessor program) execute many millions of program statements each time they are used, but most of these statements are the same ones being executed over and over many times. This chapter will discuss several kinds of loops in Java. Chapter Topics:
|
QUESTION 1:Think of some machines (mechanical or other) that use cycles to run until the job is done. Click Here after you have answered the question |