For this project you will develop a Ruby script to
process Comma Separated Value (CSV) files representing a class grade book.
The format of a grading CSV file is as follows:
example.csv
Last,First,Exam,Homework,Attendance
,,50,30,20
Awesome,Abigail,98,95,100
Doofus,Douglas,75,65,60
The file example.csv is provided for you. Other
files may have a different number of columns, different column headings, a
different number of student grade lines, different student names, etc. You should consider creating other files to use for your own testing.
All
input is read from the standard input (via input redirection from a file), and
all output is written to the standard output. There is no need to explicitly
open and close files, or to process any command line arguments. A standard
invocation of the script would look like:
Download the following files to a directory in your repository name Project-1
In the first release we'll focus on developing the support methods in grades_util.rb that will be used by grades.rb to read csv files and produce grade reports. Complete the following methods in grades_util.rb and create unit tests that thoroughly test each method:
Note that Release 1 does not involve grades.rb or reading csv files. The methods in grades_util.rb are exclusively invoked from the unit tests in test_grades.rb. See the sample test in test_grades.rb.
Release 1 Submission
By the due date specified on the class website, push the directory Project-1 to your pushbox. It will include:
If you do not make a Release 1 submission by the specified due date, you will lose 15 points (out of 100) for the overall project grade (i.e. - your best possible grade would be 85/100). Final grading for the support methods and unit tests will be done after the submission of Release 2, so you may continue to modify them after the Release 1 due date.
Release 2 Submission
By the due date specified on the class website, push the directory Project-1 to your pushbox. It will include:For level 1 read the first two lines and print out the column headings and weights, one heading per line.
For the example above, the output would be EXACTLY:
Summary information for grades file
Last
First
Exam 50%
Homework 30%
Attendance 20%
Assume we change the example input CSV file to the
following:
The output would be:
Summary information for grades file
Last
First
Exam 50%
Homework 30%
Attendance 10%
Weights add up to 90, not 100
This level will read and output each line of student grade
information. For each field in such a grade line, the output is the field
header (from the first line in the file) and the contents of the associated
field from the student grade line. For our example, the output would be:
Summary information for grades file
Last
First
Exam 50%
Homework 30%
Attendance 20%
Last: Awesome
First: Abigail
Exam: 98
Homework: 95
Attendance: 100
Last: Doofus
First: Douglas
Exam: 75
Homework: 65
Attendance: 60
For this level you will compute each students final
numeric and letter grade. The final numeric grade is the sum of each received
grade times the associated weight divided by 100. The letter grades are
assigned using the normal scheme: 90 and above is an A, 80 up to 90 is a B, 70
up to 80 is a C, 60 up to 70 is a D, and anything less than 60 is an F.
Below is the output for our sample file:
Summary information for grades file
Last
First
Exam 50%
Homework 30%
Attendance 20%
Last: Awesome
First: Abigail
Exam: 98
Homework: 95
Attendance: 100
Final Numeric Grade = 97 Letter = A
Last: Doofus
First: Douglas
Exam: 75
Homework: 65
Attendance: 60
Final Numeric Grade = 69 Letter = D
For this level we will add in support for letter
grades as well as numeric grades. That is, any field that previously could hold
a numeric grade may now hold a letter grade (the letters themselves may be
either upper or lower case). It is even possible that, for a given field, some
students will have a letter grade while others will have numeric grades.
The letter to numeric correspondence is shown in the
table below – the fact that the letters are all upper case does not mean that only
upper case letters will be in the grades file!
A+ |
98 |
B+ |
88 |
C+ |
78 |
D+ |
68 |
F+ |
55 |
A |
95 |
B |
85 |
C |
75 |
D |
65 |
F |
40 |
A- |
92 |
B- |
82 |
C- |
72 |
D- |
62 |
F- |
25 |
Individual
grades will be printed as numbers or letters based on the value in the
associated field. The final numeric grade, however, will be computed using the
table of equivalences above.
Assume we change the example input CSV file to the
following:
Last,First,Exam,Homework,Attendance
,,50,30,20
Awesome,Abigail,a+,95,100
Doofus,Douglas,75,D,60
Then the output would look like the following:
Summary information for grades file
Last
First
Exam 50%
Homework 30%
Attendance 20%
Last: Awesome
First: Abigail
Exam: a+
Homework: 95
Attendance: 100
Final Numeric Grade = 97 Letter = A
Last: Doofus
First: Douglas
Exam: 75
Homework: D
Attendance: 60
Final Numeric Grade = 69 Letter = D
For the final level, provide a summary of the
grades for the class as a whole which includes the number of
A’s, B’s, etc., as well as the overall class GPA. The class GPA is simply the
count of A’s times 4 plus B’s times 3 plus C’s times 2 plus D’s times 1 divided
by the total number of students in the class.
Summary information for grades file
Last
First
Exam 50%
Homework 30%
Attendance 20%
Last: Awesome
First: Abigail
Exam: a+
Homework: 95
Attendance: 100
Final Numeric Grade = 97 Letter = A
Last: Doofus
First: Douglas
Exam: 75
Homework: D
Attendance: 60
Final Numeric Grade = 69 Letter = D
A = 1
B = 0
C = 0
D = 1
F = 0
Class GPA = 2.50