SWEN-250 Personal Software Engineering
Project 1 - Ruby Grades CSV

Overview

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:

  1. The first line is a list of headings to be applied to the associated information in the lines that follow. You may assume that there are no empty headings, and that the headings contain only letters and digits. You may also assume that all lines after the first have exactly the same number of fields as this header line.
  2. The second line is a set of numeric weights, giving the relative contribution of the grade in the associated column to the overall grade. Each field is either:
  3. The third and following lines all record the grade information for individual students, one student per line. 

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:

ruby grades.rb < example.csv

 

Project Instructions - There are two distinct releases for this project - PLEASE READ CAREFULLY

Download the following files to a directory in your repository name Project-1

Release 1 - Writing and testing grades_util methods

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:
To encourage incremental development there are 6 levels of submissions. You may stop at any level and receive up to the cumulative grade at that point, but you must have submitted an entry for all preceding levels. When you have completed a level, use the commit message "*** Level n Complete ***" before starting the next level. Only your last completed level will be graded, but your git log must demonstrate that you developed and tested the application incrementally to receive full credit.

Level 1 (5 points)

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%

Level 2 (5 points)

Verify that the sum of entered weights are exactly 100%. If not, output the following error message and exit the program

Weights add up to xx, not 100   ( where xx = sum of the input weights)

Assume we change the example input CSV file to the following:

Last,First,Exam,Homework,Attendance
,,50,30,10
Awesome,Abigail,a+,95,100
Doofus,Douglas,75,D,60

The output would be:

Summary information for grades file

Last
First
Exam 50%
Homework 30%
Attendance 10%

Weights add up to 90, not 100


Level 3 (5 points)

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

Level 4 (10 points)

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

Level 5 (5 points)

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

Level 6 (5 points)

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

Quality Assessment & Project Journal (15 points)

Grading Summary (100 points)