Fundamentals of Computer Science I (CS151.02 2007S)
[Skip to Body]
Primary:
[Front Door]
[Syllabus]
[Glance]
[Search]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
[Reading]
[Lab]
[Assignment]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Projects]
[Readings]
Reference:
[Scheme Report (R5RS)]
[Scheme Reference]
[DrScheme Manual]
Related Courses:
[CSC151 20056F (Rebelsky)]
[CSC151.01 2007S (Davis)]
[CSCS151 2005S (Stone)]
This assignment is also available in PDF.
This project is intended to serve as a form of makeup
for the
those who are not satisfied with their grade on the first project. It
is due on Friday, 18 May 2007.
Summary: In this assignment, you will build a simple grading system.
Professor R has recorded the grades for the semester in a file, using
the following free form
format. Each line of the file represents
one grade, and either has the form
name,thing,grade
or the form
name,thing,grade,comment
Things are either homework (the word HW
plus a number), exams
(the word Exam
plus a number), a project grade (the word Project
),
a participation grade (the word Participation
), or
a count of extra credit (the word Extra
).
Exam grades are integers. Homework grades may be Zero, Minus, Check Minus, Check, Check Plus, or Plus. Participation grades are integers. Project grades may be A, A-, B+, B, B-, C+, C, D, F, or Zero. Counts of extra credit are integers.
For example, here are some grades
Davis,Exam1,100 Davis,Exam2,105 Davis,Exam3,104 Davis,Exam4,80 Davis,Extra,6,Convo+Convo+CS Extra+Softball+Ultimate+Concert Davis,HW1,Plus Davis,HW4,Plus Davis,Participation,95 Davis,Project,B Rebelsky,Exam1,104 Rebelsky,Exam2,75,was 25 Rebelsky,Exam3,85 Rebelsky,Exam4,0,Did not take the final Rebelsky,Extra,0 Rebelsky,HW1,Check Rebelsky,HW4,Zero Rebelsky,Participation,90,docked for talking too much Rebelsky,Project,A-
a. Looking at this problem, it is clear that one thing we'll need to do
is to break apart the lines of the file into their component parts.
Write a procedure, (split-line line)
, that, given
a string, builds a list of the parts of the string, splitting the string
at commas.
> (split-line "Rebelsky,Project,A-") ("Rebelsky" "Project" "A-") > (split-line "Davis,Extra,6,Convo+Convo+CS Extra+Softball+Ultimate+Concert") ("Davis" "Extra" "6" "Convo+Convo+CS Extra+Softball+Ultimate+Concert")
Note that you can scan through the string using
string-ref
to find the positions of commas and then use
substring
to extract portions of the string.
b. We'll assume that we're just trying to compute the grades for a
single student. Write a procedure, (gather-grades name filename)
, that finds all the grades for the named student and
builds a five-element vector:
Using the sample grades above, we should get something similar to the following results.
> (gather-grades "Rebelsky" "sample-grades") #5(("104" "75" "85", "0") ("Check" "Zero") "A-" "90" "0") > (gather-grades "Davis" "sample-grades") #5(("100" "105" "104" "80") ("Plus" "Plus") "B" "95" "6")
c. In order to compute numeric grades, we will need to convert
the other forms of grades to numbers. Write a procedure,
(checkgrade->number grade)
, that converts a grade
on the check/plus/minus scale to a number using the following polices:
d. Of course, I use letter grades in addition to the check/plus/minus
scale, so we'll need to handle that, too. Write a procedure,
(lettergrade->number grade)
, that converts a grade
on the standard letter scale to a number using the following policies:
e. Write a procedure, (samr-policy grade-vector)
,
that computes a numeric grade using the following policies:
In the end, it should be possible to find someone's grade as follows:
(define grade (lambda (name file) (samr-policy (gather-grades name file))))
Monday, 7 May 2007 [Samuel A. Rebelsky]
Tuesday, 8 May 2007 [Samuel A. Rebelsky]
[Skip to Body]
Primary:
[Front Door]
[Syllabus]
[Glance]
[Search]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
[Reading]
[Lab]
[Assignment]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Projects]
[Readings]
Reference:
[Scheme Report (R5RS)]
[Scheme Reference]
[DrScheme Manual]
Related Courses:
[CSC151 20056F (Rebelsky)]
[CSC151.01 2007S (Davis)]
[CSCS151 2005S (Stone)]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Tue May 8 11:42:24 2007.
The source to the document was last modified on Tue May 8 11:42:17 2007.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2007S/report.02.html
.
You may wish to
validate this document's HTML
;
;
http://creativecommons.org/licenses/by-nc/2.5/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.