Java Reference
In-Depth Information
Lab 9.1: Using Arrays
In this lab, you will modify your Powerball class from Lab 5.3 so that it
keeps track of each colored ball in a single array.
1. In your text editor, open your Powerball class from Lab 5.3.
2. Remove the five fields that represent the five white balls. Add a
single field that is a reference to an array of type int.
3. Within the Powerball constructor, assign the field in the previous
step to a new int array of size five.
4. Modify the remainder of the Powerball class so that it uses the array
of ints to store the values of the five white balls. Use a for loop and
the length attribute of arrays when displaying the results in the
displayResults() method.
Lab 9.2: Using javadoc
In this lab, you will run the javadoc tool to create documentation for your
Powerball class.
1. First off, delete the bytecode file Powerball.class from your hard
drive. (I do not want the Powerball.java and Powerball.class files in
the same directory.)
2. Add your Powerball class to a package named lottery.
3. Compile the class using the -d flag, which will create a \lottery
directory.
4. Move Powerball.java from its current directory to the \lottery
directory.
5. Add javadoc comments throughout your Powerball class, for all
fields, methods, and constructors. Use the @param tag for any
method parameters, and the @return tag for any return values. Add
an @author and @version tag as well, and any other javadoc tags
that you want to experiment with.
6. Run javadoc on the lottery package using the command line:
javadoc -author -version -private lottery
Search WWH ::




Custom Search