School of Engineering and Applied Science
Department of Computer Science
CSci 53 -- Introduction to Software Development
http://www.seas.gwu.edu/~csci53/fall02
Prof. Michael B. Feldman
mfeldman@seas.gwu.edu

Lab Exercise #9
for labs meeting Tuesday, Nov. 19, 2002

Part 1:

Modify LetterCount.java (p. 326) to implement an application that creates a histogram (bar graph) that allows you to visually inspect the frequency distribution of a set of letters. The program should read in an arbitrary number of letters, then produce a chart similar to the one below that indicates how many of each letter were entered. Count uppercase and lowercase together in one array; that is, one 'A' and one 'a' result in a count of 2, in the first element of the array. HINT: Use Screen.java to plot the bars from the bottom upward.

|
|
|
|                                       *
|                                       *
|                                       *
|                                       *
|                             *         *
|     *   *       *           *     *   *
| *   *   *       *         * *     *   *
| *   *   *       *         * *     *   *
| *   *   *       *     *   * *     *   *
| *   *   *       *     *   * *     * * *
| *   *   *       *     *   * *     * * *
| *   *   *       *     *   * *     * * * *
| *   *   *     * *     * * * *     * * * *   *
| *   *   * *   * *     * * * * *   * * * *   *
| *   * * * *   * *     * * * * *   * * * *   *
| * * * * * *   * *     * * * * *   * * * *   * * *
| * * * * * * * * * * * * * * * * * * * * * * * * * *
-----------------------------------------------------------
  a b c d e f g h i j k l m n o p q r s t u v w x y z
 

Part 2:

The bars in the histogram will be too long if a large number of values is entered. Modify the program so that it prints an asterisk for every five occurrences of a given letter.
 

(end of lab)