Due: 5:00pm, Friday, September 21. Value: 30 pts.
Learn the basics of the Ruby programming language. One way to do this is to read pages 29 through 49 of the book Seven Languages in Seven Weeks. Or a really bizarre introduction: why's poignant guide to Ruby.
One of the most useful applications of a scripting language like Ruby (or Python) is to produce a summary of data stored in a text file. So that's what you're assigned to do. In particular, you should write a script that walks through a file for recording grades and then displays a summary of missing grades and students' total grades. (In fact, I personally use a file basically in this format with an associated Python script for generating summaries.)
As illustrated in the below example, the grades file contains three types of lines: empty lines to be ignored; lines beginning with a dollar sign, followed by the number of points that item is worth and then the item name; and lines recording a student's grade for the last-mentioned grading item followed by the student's name. You can assume that spaces separate the parts of a line; this allows you to use strings' split method to divide a line into pieces.
$ 30 Assn1 28 Alice 28 Carrie $ 30 Assn2 30 Alice 25 Bob
Your program is to produce a summary consisting of two parts: First the program should list any assignment where a student mentioned in a previous assignment does not have a grade recorded, and then it should list the number of points earned by each student, sorted by student name, followed by the total number of points possible. For example, the above example file should lead to the following output. (It does not mention Bob missing Assn1 since Bob was not mentioned previously in the file.)
Carrie did not complete Assn2 58 Alice 25 Bob 28 Carrie 60 points possible
A more complex file is available for testing. [Download.] The expected output for this file is as follows.
Eve did not complete Assn3 Krunch did not complete Assn3 Eve did not complete Assn5 Krunch did not complete Assn9 849 Alice 965 Bob 982 Carrie 817 Eve 692 Krunch 962 Spot 1000 total possible
You may find my Python implementation useful for reference. [Download.]