![]() |
Computer Science Department |
Objectives: |
|
Background: |
We have already worked with if statements to detect erroneous data. But in some cases users will repeatedly enter the wrong value. In addition, some problems lend themselves to repeatedly executing the program. For example, in PA2, it would be useful to execute the program for not just one star or planet, but for a series of stars or planets of the user's choosing. This lab will explore these uses of the Java loop. |
New Terms: |
|
Materials: |
You will use your
EightBall.java program from a prior
lab for today's lab. If you did not finish this lab, download a
model solution from here.
There are a couple of minor differences in this version, but it
can be used for this program. You will need to use some of the String methods for this lab. This is a link to the Java documentation for the methods for String. Java documentation is known as the Java APIs. A link to all of the APIs is found on our resources page. You will find on this page a list of all the methods for the String class. And by clicking a method in the method summary chart, you will go to the more detailed description of that method. |
Acknowledgment | Lab by Nancy Harris |
Set up your programming environment for this lab. You should create a folder into which you will store both programs.
Download your EightBall.java program from the prior lab.
Do each step and test it before moving on to the next.Updated 10/18/2011 (nlh)