A7: Calculate Your Grade

On This Page


Overview

During this assignment, you will:

  • Calculate your grade for this course
  • Read and accumulate data from text files
  • Write a report to a text file and the console

Background Information

Grades are calculated by dividing the total actual points by the total possible points within each assessed area. These numbers are usually expressed as a percentage. For example, we may have 10 exercises worth 10 points each, or 100 points total. Your actual score on the exercises may add up to 95 points. Thus, your total exercise score is 0.95, or 95%.

Since there are multiple areas of assessment, you must calculate the percentages for each area and multiply the percentage times the weight for that area. Continuing our example, exercises may be worth 15% of the total grade. Thus the weighted percentage is 0.95 * 0.15 = 0.1425.

To arrive at your total score, you sum the weighted percentages of each area.

Note the following information about scores and grading:

  • All the evaluation areas and weights are on the Course Information page.
  • Since you have not taken the final exam yet, your final grade will be different than your score to date.
  • Each individual item in some assessed area may have different possible scores. For instance, assignment 1 has a possible score of 10 while assignment 2 has a possible score of 20. Thus, for every item you must consider data for both possible scores and actual scores.
  • The lowest exercise score is dropped in determining the weighted percentage for exercises.
  • It is possible to earn more credit on an assignment, at least in this course, than the maximum score. This is accomplished through extra credit and helps students make up for problems on any one assignment.
  • The scores in one evaluation area cannot influence the scores in another. For instance, if you have 105% on your assignment scores, you cannot apply the extra 5% toward the total score.
  • All your score data is in WebCT.

Specifications

Create a grade calculation application that reads your scores from text files, named as specified below, and then calculates and reports your grade for this course. Use the gradebook.cpp starter code to begin the development of your application.

Inside main(), read data from a file for each area using the loadScores() function. The loadScores() function opens the file and then reads and sums the total possible and total actual points.

After returning the sum of the total and actual points, in main() call the calcWeightedPct() function to calculate the weighted percentage of each areas points. Save each of the weighted percentages in variable and pass these variables to the report() function to produce the report output. Call the report() function twice: once to write to the screen and another time to write to a file.

Sample Input Files and File Format

You must use the following file names and format. Also, I will use these files to test your code (among others):

File Format: note that the data appears in two column. The first column is the nominal total points and the second column is the actual score. Thus each assignment, exercise or test will have two entries each.

Sample Output

Write a report like the following to an output file named grade.txt. In addition to writing a file, display the report to the screen.

Weighted Scores:
Assignments:    0.30 / 0.30
Exercises:      0.12 / 0.15
Midterm:        0.17 / 0.20
Final Exam:     0.00 / 0.35

Sum of percentages: 0.59
Letter grade to date: F
Percentage without final: 0.91
Letter grade without final: A

Note that this report was produced by the Sample Input Files provided above.

Required Functions

You must code the following functions exactly as specified, though you may add more functions if you like.

/**
 * Load the scores from the fileName into data[].
 *
 * @param fileName The name of the file.
 * @param total The nominal total value of all scores.
 * @param actual The actual value of all scores.
 */
void loadScores(string fileName, int& total, int& actual);

/**
 * Calculates the weighted percentage of the score.
 * Also makes sure that the score does not exceed 100%.
 *
 * @param total The nominal total value of all scores.
 * @param actual The actual value of all scores.
 * @param weight The weight to apply to the calculated score.
 * @return The weighted percentage.
 */
double calcWeightedPct(int total, int actual, double weight);

/**
 * Outputs the grade calculations to the stream in the
 * specified format.
 *
 * @param out The output stream for writing the report.
 * @param wpAsn The weighted percentages of assignments.
 * @param wpExer The weighted percentages of exercises.
 * @param wpMid The weighted percentages of midterms.
 * @param wpFinal The weighted percentages of finals.
 */
void report(ostream& out, double wpAsn, double wpExer,
    double wpMid, double wpFinal);

/**
 * Converts the percentage to a letter grade.
 *
 * @param percentage The percentage to convert.
 * @return The letter grade.
 */
char toLetterGrade(double percentage);

Additional Specifications

  1. The name of the program source code file must be gradebook.cpp.
  2. You must turn in four data files containing your data in the specified file format:
    • asn.txt: all your assignment score data
    • exer.txt: all your exercise score data except the lowest
    • final.txt: your final exam score data
    • mid.txt: your midterm score data
  3. You must remove the lowest exercise score from your exer.txt file.
  4. Note that you do NOT write any code for this step. You just remove your lowest exercise score using a text editor.

  5. Since you have not taken the final exam yet, your final.txt file must contain just two entries exactly like the supplied file.
  6. All input must be from files (do NOT use any keyboard input statements, like cin, in this assignment).
  7. If you use a cin statement in your program, you will get a low score.

  8. Report numerical results using two decimal places.
  9. Do not forget to document all the code. Though I have put a few comments in the starter code, you are responsible for the accuracy and completeness of the final comments.

Extra Credit

The following are worth extra credit points:

  1. Complete the assignment using pair programming. (1 point)
  2. Add code that returns the percentage you need to achieve on the final exam to get an "A", "B" and "C" grade in the course. For example, for the data example, you should see: (1 point)
  3. Score needed on final for A: 88.57%
    Score needed on final for B: 60.00%
    Score needed on final for C: 31.43%
    

Make certain that your README.txt file describes any extra credit attempted.

Grading Criteria

The instructor will evaluate your assignment using the following criteria. Each criteria represents a specific achievement of your assignment and has a scoring guide. The scoring guide explains the possible scores you can receive.

Some scoring guides have a list of indicators. These indicators are a sign of meeting, or a symptom of not meeting, the specific criterion. Note that a single indicator may not always be reliable or appropriate in a given context. However, as a group, they show the condition of meeting the criterion.

For information on grading policies, including interpretation of scores, see the course information page.

Program Compilation

  • 4: Source code compiles with no errors or warnings
  • 2: Source code compiles with warnings
  • 0: Does not compile or wrong file turned in

Functionality

  • 10: Demonstrates mastery of the assignment
    • Has extra features or demonstrates techniques beyond the assignment
    • Applies concepts from the lesson(s) appropriately
    • Meets all specifications (see above) with particularly elegant solutions
    • No errors encountered during operation
  • 8: Has all the functionality expected of the assignment
    • Demonstrates many techniques from the lesson
    • Meets all specifications (see above)
    • Implementation seems more complicated than necessary.
    • May have one minor error
  • 6: Has most of the functionality expected of the assignment
    • Demonstrates some techniques from the lesson
    • Meets all but one of the specifications (see above)
    • Implementation seems excessively complicated.
    • May have 2-3 minor errors
  • 4: Has some of the functionality expected of the assignment
    • Demonstrates some techniques from the lesson
    • Meets at least 1/2 of the specifications (see above)
    • Implementation seems excessively complicated.
    • May have more than 3 minor errors
  • 2: Serious functional problems but shows some effort and understanding
    • Meets less than 1/2 of the of the specifications (see above)
    • Has a major error or many minor errors
    • Implementation seems very convoluted
    • Demonstrates few techniques from the lesson
  • 0: Does not execute or no specifications met

Code Documentation

  • 4: Code is well-documented
  • 3: Code has minor documentation errors
    • Has 1 documentation error
  • 2: Code has some documentation errors
    • Has 2-3 documentation errors
  • 1: Code has many documentation errors
    • Has more than 3 documentation errors
  • 0: No apparent attempt to document code

REAME.txt File

  • 2: README.txt file submitted with specified information included
  • 1: README.txt submitted but some information was not included
  • 0: No README.txt submitted

Maximum Score: 20, plus extra credit

What to Turn In

Submit your assignment following the instructions for homework. Include the following items for grading:

  1. README.txt file
  2. gradebook.cpp with all source code needed to make your program function.
  3. Four data files containing your grade information as follows and in the specified file format:
    • asn.txt: all your assignment score data
    • exer.txt: all your exercise score data except the lowest
    • final.txt: your final exam score data
    • mid.txt: your midterm score data
  4. Any other file needed to make your program function

You must submit all the files needed to make your assignment function properly. Do not assume that the instructors has any files unless explicitly stated by the instructor. Your assignment must work as submitted.

Home | WebCT | Announcements | Day Schedule | Eve Schedule
Course info | Help | FAQ's | HowTo's | Links

Last Updated: October 25 2005 @18:14:08