1while Loops9/19/20072Opening Discussion■Let's look at some solutions to the interclass problem.■When is the for loop not ideal? When you can't easily calculate beforehand how many iterations to do.■Using the Java view in Alice.■Do you have any questions about the project?3The while Loop■Last time we saw how we can use a for loop to repeat code a certain number of times. As long as we could calculate the number of times in advance it worked great.■Many times you want something to happen until a certain condition is achieved. For this you use a while loop.■The while loop takes one argument, a boolean expression. The body is executed repeatedly as long as the statement is true.■If the body of the loop can't change the condition you get an infinite loop.■The while loop is a pre-check loop.4Serious Coding■Now that we have a lot more elements to play with, I want us to write something more significant in Alice.■Though it might pain some of you, I want to pull in a little physics here so that we can use a bit more of our math skills in Alice.5Minute Essay■Do you have a good idea of what you want to do for the project?■Interclass Problem – Do one of the following problems: 4.9, 4.10, or
View Full Document