# CS 1101: Lab 3

## Lab Motivation and Goals

By the end of this lab, you should be able to:
• write data definitions and templates for lists of structures,
• and write Scheme programs over lists of structures.

## Exercises

You've been hired as a TA for a course, and want to automate your handling of student grades. The gradebook entry for each student store the student's name, 5 numeric grades (hwk1, hwk2, hwk3, midterm, final), and a final letter course grade. A gradebook contains a gradebook entry for each student in the class.

1. Develop a data definitions and examples of data for gradebooks.

2. Write the template for programs over gradebooks.

3. Write a function `names-with-grade` that consumes a gradebook and a course (letter) grade and returns a list of names of students who have the given letter grade as a course grade.

4. Professors send reports to the registrar's office that show each student's name and course (letter) grade. Write a data definition for reports, then write a function `produce-report` that consumes a gradebook and produces a report showing each student's name and course grade.

5. Write a function `any-missing-midterm?` that consumes a gradebook and returns a boolean indicating whether any student has a score of 0 on the midterm.

Everyone should be able to finish up to this point

6. Write a function `count-high-hwk` that consumes a gradebook and returns the number of students who have grades above 85 on all three homeworks.

7. Write a function `compute-course-grades` that consumes three numbers (explained below) and a gradebook and produces a gradebook. The produced gradebook should have the same data as the input gradebook except for the course grade. The course grade should be computed by weighting each homework as 15%, the midterm as 25%, and the final as 30% (assume all grades are out of 100 points), then converting the result to a letter grade. The three number inputs are the cutoffs for A, B, and C grades, respectively. Students get the highest grade for which they have at least the corresponding cutoff, or an NR if they are below all of the cutoffs. Assume the cutoff for A is higher than for B and the cutoff for B is higher than for C.

Back to the Labs page