Assignment 5: Grades

This assignment is to be completed individually. It is not a team project.

You must document (using comments in your code) all resources (beyond our official textbook, Sakai, the class discussion forum, or the class website) that you used to help you complete this assignment.  For example, if you referenced a code example from an online website such as Stackoverflow or github you could acknowledge it as follows:

# Next we print 'Hello, World' to the console.
# Based on help from: https://stackoverflow.com/questions/826948/syntax-error-on-print-with-python-3
print("Hello, world!")
		

You must provide an attribution to any resource you consulted to complete this assignment except for our official textbook, Sakai, class discussion forum, or the class website. Resources that require attribution include — but are not limited to — websites, books, notes from other students, tutors, or help from other people (friends, classmates, etc.). Under no circumstances are you to look at or copy any material related to another student's solution for this assignment.

To repeat, you must attribute any resource you consulted to complete this assignment other than our official textbook, Sakai, class discussion forum, or the class website. Failure to provide attribution is a violation of the honor code.

Overview

For this assignment, you'll be reading grade data from a file, determining student letter grades, and writing the results to a new file. The details for how your program should work are described in the Basic Requirements and Advanced Requirements sections below.

Input Data. A sample input data file of the type that your program should process is available here: sample_grade_input.txt. This sample file contains fake grade data for 14 students. However, your program should be able to work with a file with an arbitrary number of students. For example, I may test your program with just 3 students, or with 300. Your program should work for any length file.

Each student record spans 3 lines in the data file. The first line contains the type of student: GRAD or UNDERGRAD. This is important because graduate and undergraduate students get graded differently at UNC. The second line contains the student's name. The third line contains the student's overall numerical grade. Your program will need to map these to letter grades according to the following rules:

For the sake of this assignment, GRAD student grades are defined as follows:

Number RangeLetter Grade
95-100H
80-94P
70-79L
0-69F

For the sake of this assignment, UNDERGRAD student grades are defined as follows:

Number RangeLetter Grade
90-100A
80-89B
70-79C
60-69D
0-59F

Please note that grades for this course are assigned as outlined in the course syllabus. The grading scales specified above are for use only in the context of this assignment.

Output Data. Your program should write the results of its computations to an output file. An example of the required output file can be found here: sample_grade_output.txt. This sample file contains fake grade data for 14 students. Each student record spans 2 lines in the data file. The first line contains the student name. The second line contains the student's letter grade.


Basic Requirements

Satisfying all basic requirements perfectly, with no points deducted for any reason, would earn a maximum score of 8 out of 10 for this assignment.

Your program should perform the following:

Two kinds of output should be produced by your program. First, an output data file should be created using the same format described in the "Output Data" paragraph of the Overview section above. Second, your program will produce output on the console in the form of status messages and prompts for user input. The output produced by your program should be nearly identical to the sample output provided below. While the specific data (names, grades, etc.) will vary based on the input provided, the data formats, prompts, and messages printed to the console when using your program should match those in the sample output files to receive full credit.

Please Note: Your program should use the flow control and conditional constructs that have been discussed in class to "stop processing the rest of the data file." In this way, the program should continue to run until the end, with your logic telling the program what to do (or what not to do). You should NOT use any special Python functions to "immediately stop" your program (e.g., using sys.exit() or a similar function is not allowed).


Advanced Requirements

Satisfying both the basic and advanced requirements perfectly, with no points deducted for any reason, will result in a full 10 out of 10 score for this assignment.

Expand on the basic requirements by extending your program as follows.


Sample Output

An example of the output produced by my solution to this assignment can be found here. When the user elects to curve the grades, the output looks like this. When an error in the data file is detected, the output looks like this.

The above files all show what is shown to the user on the screen. There is also the output data file, of course, which contains the assigned letter grades if no error occurs. An example of the data output file is available here.


Grading Criteria

This assignment will be graded on a 10 point scale. Your grade for this assignment will be based on a combination of factors including:

Seeking Help

For general questions about Python, please use the class forum on Piazza to seek assistance. For questions that are personal in nature or that would reveal a solution to the assignment, you ask for help by email or during office hours. However, please note that emailed questions will not receive an immediate response. It is likely that it will take 24-48 hours for me to respond.


Submitting Your Solution

Please Note: You must name the main python file for your assignment "assignment<number>_<onyen>.py". For example, for assignment 3 I would name my file assignment3_gotz.py because my onyen is gotz.

Using the wrong name for your file will be cost you points on your assignment grade. Please follow this requirement carefully!

Please submit your assignment via Sakai. You should submit a zip file containing your entire project folder. To create the zip file, follow the submission instructions that have been posted at the bottom of the "Other Information" page on our course website.

The due date for this assignment can be found on the course schedule.