Algorithm Development - CS 239 |
|
|
|
|
|
Software
Requirements Specification
Programming
Assignment 1
Part 1
Due Thursday, Feb 10 (2pm) at start of class 30%
Part 2 Due Tuesday Feb 15 (10pm) in the Linux Submit tool 70%
Introduction
Purpose: This application will perform final CS239 grade calculations from an input file consisting of student name, id, and course grades and will output the final grade for grade report processing.
Background
General
Information: The input file is a download
from an Excel spreadsheet. The
following describes the file contents and the weighting of each of the grade
components. The fields are in a comma
separated format with no heading row.
Entry
Token Description |
Data
Type |
Grade
Weights (doubles) |
Student Name full name like Amy Sue Johnson |
String |
|
Student Id |
short |
|
Lab Grade Average |
double |
0.10 |
Programming Assignment Average |
double |
0.20 |
Midterm Exam 1 |
int |
0.20 |
Midterm Exam 2 |
int |
0.20 |
Final Exam |
int |
0.30 |
Existing Program Components: No existing components.
New Components: Your application will consist of four classes, StudentRecord, GradeCalculator, Communicator, and PA1Driver.
Required Program Structure and Function
Each class must be in its own file. All four Java files for Part 1 should be printed out and brought to class. .
Only these four classes may be developed.
Deliverables
Part 1 - Stubs and Drivers
This is the design phase of your application development. Based on the information above and below, you should create 4 Java files, one for each class. Into these files, you should put each method header as described above and en empty body. If a method returns a value, you must create a return statement that returns a default value of that type.
Each method and class is described below should be documented using javadoc documentation as well as inline comments that describe in detail the steps that you will take in that method. Each class should be documented as well. You may add additional methods but not additional classes.
THERE SHOULD BE NO OTHER CODE OTHER THAN HEADERS AND RETURNS. The comments though should be detailed enough that anyone else could take your program and add code to accomplish that task, maintaining the same design. Return statements should return a dummy value of the designated type.
Along with the Stubs and Drivers, you should provide a sample input file that you will use for testing your final program.
See StubandDriver.java for an example of what you should produce.
Part 2 Finished Application
The finished application should be submitted to the Linux Submit system no later than Tuesday, Feb 15 at 9pm. All four Java files must be submitted. The hardcopy listing of the files should be turned in during lab on Wednesday Feb 16 and must be the pdf file produced by your submit..
Details
of Classes - needed for Part1 as well as Part2
PA1Driver
The PA1Driver starts the grade calculation process. This method will contain a single main method that will build a Communicator object and start the grade processing process. This class may contain no global variables (attributes) and no additional classes.
Communicator
The Communicator classs primary function is to bridge the other classes and take in the required inputs and outputs. Communicator controls the action of the process of handling student grades.
The Communicator class must have:
1. A constructor that takes no parameters. This constructor should call the runProgram method which will then call the other methods to perform the program's work. .
2. The runProgram method will obtain the names of the input and output files from the user, instantiate them and call processGrades method.
3. A processGrades method that reads an input file, creates a StudentRecord from the data, updates that record with final grade information and finally writes the completed data to an output file.
4. A parseStudentRecord method that takes in a String representing data for a single student from a file and returns a StudentRecord object.
5. A calculateGrade method that takes in a StudentRecord object, updates the record with the weighted average and final alpha grade and returns nothing.
You may add additional methods to the Communicator class.
This class holds the student record information. It holds the name and id of the student, the values for each of the grade components, and the final average and final grade. Each correct grade component and the final average will be expressed as a number less than or equal to 100.
This class must have:
1. A constructor that builds a student record. The constructor is passed the name, id, and five (5) input grade components for each student in its parameter list.
2. A toString method that takes in no parameters and returns all of the information about a student in a String format.
3. Accessor methods (getXxxxx-where Xxxxx is replaced by a description of the item) that have an empty parameter list, and return a single value from instance variables of the class.
4. A setFinalGrade method that receives the final numeric grade as a parameter and sets the final numeric grade attribute.
5. A setAlphaGrade method that receives the final letter grade as a parameter and sets the final letter grade attribute.
You may add additional methods to the Communicator class.
The GradeCalculator class contains methods that calculate the final numeric and letter grades for a student. All methods of this class are static. Each of these methods will take a single StudentRecord object as its input parameter and will use accessor methods of the StudentRecord class to obtain the data required for the calculation and return the computed values.
This class must have:
1. Five (5) constant attributes for each of the grade weights.
2. A static method weightedAverage that takes in a StudentRecord object and returns the weighted numeric grade.
3. A static method letterGrade that takes in a StudentRecord object, uses the final exam and final numeric grade and returns the String equivalent of the final numeric grade based on the following chart:
Higher than |
String grade |
92.99 |
A |
89.99 |
A- |
86.99 |
B+ |
82.99 |
B |
79.99 |
B- |
76.99 |
C+ |
72.99 |
C |
69.99 |
C- |
66.99 |
D+ |
59.99 |
D |
0 |
F |
-1 in the final exam grade causes |
F as a final grade regardless of the numeric average |
Other requirements:
Output file requirement
1. The output file will use a # delimiter between its fields.
2. The output file must begin with a header record with labels for each of the values in the file. The header record labels will be separated from one another by the same delimiter as the data.
3. The file contains one line per student record and each record should contain the data in the order shown below. The type of the original StudentRecord object values should be retained.:
Field or attribute |
Heading Label |
Student Name |
name |
Student Id |
id |
Lab Grade Average |
lab |
Programming Assignment Average |
programs |
Midterm Exam 1 |
exam1 |
Midterm Exam 2 |
exam2 |
Final Exam |
finalExam |
Final Average |
finalAve |
Final Grade |
finalGrade |
Error Checking and Handling
1. If a file that the user is trying to use for input is not found, an appropriate error message must be displayed and the user asked again until a valid file is found.
2. If a file that the user is trying to use for output cannot be opened, an appropriate error message must be displayed and the user asked again until a valid file is found.
3. The instructor will use the code NG for any grade that is missing. The program should replace the NG with a zero grade for any grade component except for the final grade.
4. If the final grade has an NG code, replace the final grade with a -1. In calculating the averages, you may use the -1 as is, but a -1 in the final grade signifies that the student will automatically fail the course, regardless of the value of the numeric average. Your GradeCalculator class must take this into account.
5. If a grade component contains an invalid entry (something other than a number), treat it as if it is an NG.
6. Any error condition in the data (such as the NG) should cause the program to echo the bad data and provide an error message to the screen that indicates how the situation is handled.
Input
Prompts and Headings
1. Your program should introduce itself to the user as soon as the application is entered. This introduction should appear on the screen.ontain a and should be separated from other text by at least one line of white space.
2. Any time that you are expecting keyboard data from the user, you should prompt the user with an appropriate message. Abbreviations should not be used, and the message should be clear with correct spelling of all words and your cursor should remain on the same line as the prompt message.
3. Your program should echo each line of data obtained from the input file to the screen as it is being read in. A single header statement should announce the beginning of the file echo.
4. Your program should display a count of the number of records that were processed with an appropriate label. on the screen at the end of the program
5. Your program should print an exit message that echoes the name of the input file and the name of the output file to the screen at the end of the program.
Hints and Suggestions
1. Good testing requires a test data set along with a prediction of the expected results. You should develop a test plan for this application.
2. For debugging purposes a toString method should be included for the StudentRecord class even though you will not use that method during the normal operation of the program.
Honor
Code
Work on this programming assignment must be done individually. At no time should another student look at your code; provide debugging or testing assistance; or provide design assistance. If you need help, you may go to any of the TA consulting hours or your instructor. You must include the JMU honor declaration in each of your Java files. Failure to turn in your own work or providing help to another student will both be considered honor violations and will be handled as such. Minimum penalty for an honor violation on this assignment is a 0 for the assignment and referral to the JMU Honor Council.