This activity uses arrays and for loops to
create a simple bar graph. Please read the notes at the end of this
file.
In addition to the discussion of the solution in the Solution document, the project for this activity contains two classes:
The objective is to print out a bar graph illustrating some data about the number of classes in successive Java versions, like this, in which each hash mark indicates one hundred classes.
1.0 |##
|
1.1 |#####
|
1.2 |##################
|
1.3 |#####################
|
1.4 |##############################
|
|----|----|----|----|----|----|----|----|----|----|
Hundreds of classes in successive versions of Java
Read the comments and complete the code for Ex2_7 by completing:
Run the project to test your answer.
1. As of NetBeans 6.9, there has been a bug in the way NetBeans
handles
the tab character in the output window and so the output may not align
correctly. If in doubt, please check the discussion of this activity to
check your understanding.
2. The code uses more than one kind of print statement: print() prints its argument, while println() prints its argument and a newline character, so that the next output begins on the following line of the screen. A println() statement with no argument simply prints a newline character.