A04

Due Date: Friday, October 6
File(s) to be submitted: GraphGrades.java
Sample Output: SampleOutput.html


SUBMIT   /   Check

Bar Graph (Loops and Conditionals)

Synopsis

Write a program GraphGrades to read in students' grades and print a bar graph of their distribution.

Details

Write a program that behaves as follows:

  1. It prints an introduction, with a title, short description of the program, and your name and A-number as author.
  2. It pauses.
  3. It prompts for and reads an arbitrary number of student grades, ending with any negative number (which is not a grade).

    For each of these student grades it updates a counter:

    1. One counter for grades 80 and above (A grades).
    2. One counter for grades 70 to 79 (B grades).
    3. One counter for grades 60 to 69 (C grades).
    4. One counter for grades under 60 (F grades).
  4. It pauses again.
  5. It prints out a titled bar graph showing how many grades were in each range. Each bar starts with a statement of the range (80+, 70-79, ...). It then has a vertical line ("|") followed by as many stars on it as there were grades in that range. The vertical bars must be lined up.
  6. It pauses one last time.

See the sample output (linked at the top of the page) for examples of what the bar graph should look like.


Grading Outline

Programs that do not compile or that crash on reasonable input will be penalized. The size of the penalty depends on how difficult the grader finds it to get the program running and tested. The submission may be assigned a grade of zero if the grader finds it too difficult to evaluate.


SUBMIT   /   Check