Homework 3: Gradebook

Due October 8 @ 8:00pm on Autolab



1. Introduction

The purpose of this homework is to give you practice programming with your first real “data structure”, and an important one in Java, the ArrayList. You will also obtain practice writing and testing a class from scratch. In this homework, you will implement a simple gradebook for a course. Your gradebook will input a CSV file containing student information and assignment grades. The gradebook will consist, basically, of an ArrayList of Students. Each student will be an instance of the Student class, but you will have to augment the initial Student class with a private instance variable that can hold an ArrayList of grades. There are other, better, ways to store grades, but it will work for this assignment, the focus of which is on ArrayLists and their operations. You will also need to write the Grade class.

Download a pre-prepared Eclipse Project hw3.zip and import it into Eclipse using these instructions. You will make all of your changes inside of the java files in this project.

2. Your Tasks

There are a variety of tasks for this homework.

2.1. The Grade Class

The Grade class will represent and store information about a single grade. A grade has two components: a name (stored as a String, e.g., HW1) and the actual grade for that assignment (stored as an int). You will need to write a constructor for this class as well as a few methods, such as getters and setters.

2.2. The Student Class

Included with this assignment is a pre-existing Person class. Since a student is-a person, you should use inheritance when creating the Student class. A student is a person who also has an andrew ID, a major, and an ArrayList of grades. You will also need to write a variety of other methods for Student as needed. Those methods are not described in detail here, you will need to figure out on your own exactly what you need.

2.3. The GradeBook Class

You will need to write the following methods in the GradeBook class. With the exception of the constructor, most GradeBook methods should be very short, as anything that involves an individual Student should be a method in the Student class, called on the appropriate Student from the GradeBook.

3. The Data File Format

The input (and output) files that your program should be able to work with have a comma separated value (CSV) format. Each line the file contains the information for one contact, with each field of that contact separated by a comma. The fields are:

First Name, Last Name, Age, Major, andrew ID, Grade Pairs, ...

Each “grade pair” consists of the name of the grade (homework, quiz, etc.) followed by the actual grade for that assignment. To keep things simple, assume you have only 4 categories of grades, formatted as follows: homeworks (HWn), quizzes (Qn), midterm (M) and Final (F). Note that there is not a specific number of grades per student, it could vary.

The provided Eclipse project includes some sample files that you can use for testing. (Looking at them will also help you make sure you understand the file format.)

4. Calculating the Course Average

The gradebook in this assignment will calculate the grade using the same percentages we are using for the course:

40% Homework
15% Quizzes
20% Midterm Exam
25% Final Exam


The formula you will use to determine the current course average is, thus:

\(avg = \frac{HW_{avg} * 40 + Quiz_{avg} * 15 + Midterm * 20 + Final * 25}{40 + 15 + 20 + 25}\)

However, if some category of grade is missing entirely, then you need to remove it completely from the calculation. For example, if you have quiz, homework, and midterm scores available but no final exam, then you would use…

\(avg = \frac{HW_{avg} * 40 + Quiz_{avg} * 15 + Midterm * 20}{40 + 15 + 20}\)

Let’s consider a practical example:
Darrel,Haley,23,Biology,dhaley,Q1,100,HW1,95,Q2,85

Darrel has some quiz and homework scores, but no midterm or final exam scores. His homework average is 95 (because there’s only one homework). His quiz average is 92.5. Therefore, his current course average is:

\(avg = \frac{95 * 40 + 92.5 * 15}{40 + 15} = 94.3181818\overline{18}\)

5. Grading and Submission

There are two parts of the grading of this assignment:

  1. For the first 70 points, your submission will be auto-graded on Autolab.
  2. For the next 30 points, your submission will be manually graded to check for things like style, implementation methodology, and the testcases you include in the main method.

You will submit your program to Autolab. Login to the system and you will see the homework.

For this homework, because there are two files, you’ll need to submit a zip file containing your code. Luck for you, however, Eclipse can create this zip file for you. Check out these instructions. On Autolab, you’ll submit that exported zip file. On the page that follows your submission you will see your live score (out of 70). It may take up to a few minutes for your score to appear, during that time just hit refresh in your browser. If you receive a lower score than you expect, you can click on the score to see the feedback from the autograder.

6. Restrictions

You may only use the following Java libraries in this assignment:

java.io.FileReader
java.io.PrintWriter
java.util.ArrayList
java.util.Arrays
java.util.Scanner

7. Important Notes