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:
-
It prints an introduction,
with a title,
short description of the program,
and your name and A-number as author.
-
It pauses.
-
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:
-
One counter for grades 80 and above (A grades).
-
One counter for grades 70 to 79 (B grades).
-
One counter for grades 60 to 69 (C grades).
-
One counter for grades under 60 (F grades).
-
It pauses again.
-
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.
-
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
- 10 points: program introduction includes title, short description, student's name and A-number
- 5 points: program prompts user for input
- 10 points: program reads multiple grades
- 10 points: program accepts multiple grades on each line
- 5 points: program does not count any student's grade more than once
- 5 points: program does not count the negative number as a grade
- 5 points: program does not count any number entered after the negative number
- 5 points: bar graph includes title
- 5 points: each line of bar graph has a clear label followed by a |
- 15 points: each line of bar graph has correct number of stars
- 5 points: each line of bar graph starts in same column
- 5 points: program has javadoc with author information (student name and A-number)
- 5 points: variable names are descriptive and in camelCase
- 5 points: program is indented correctly
- 5 points: program uses good vertical and horizontal spacing
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