A7-Calculate Your Grade

On This Page


Overview

There are three parts to this assignment:

  1. Review Exercises:

    First make sure you have completed and turned in the exercises from lesson 7. Then complete the exercises in CodeLab 7. These exercises will help prepare you for the problem-solving program and should be completed first. You can look at solutions if you miss your first attempt.

  2. Problem Solving Program:

    Complete the programming project following the Program Specifications listed below. You may make extra credit additions to this program as outlined in the section on Extra Credit.

  3. Tutorial Exercises:

    Complete the specified exercises in the section titled Tutorial Exercises below to prepare for the next lesson.

Background Information for Program

Grades are calculated by dividing the sum of the scores by the sum of the values within each assessed area. These numbers are usually expressed as a percentage. For example, we may have 10 assignment scores worth 40 points each and one worth 80 points, or 480 points total. Your actual scores on assignments may add up to 456 points. Thus, your total assignment score is 456 / 480, which is 0.95 average, or 95%.

Since there are multiple areas of assessment, you must calculate the averages for each area and multiply the average times the weight for that area. Continuing our example, assignment scores may be worth 40% of the total grade. Thus the weighted average is 0.95 * 0.40 = 0.38.

To arrive at your total score, you sum the weighted averages of all areas. Thus if your weighted averages for all areas are: 0.38 + 0.213 + .323, your overall grade for the course is .916, or 91.6%, which is an "A" letter grade.

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.
  • It is possible to earn more credit on an assignment, at least in this course, than the maximum score. You can do this with extra credit and this 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 Blackboard.

Program Specifications

Note that you must complete this program either by yourself or by working with one other student of this class following the rules of Pair Programming for Homework Assignments.

  1. Write a program that calculates your grade for this course, using the starter code: gradebook.cpp
  2. Your program must collect user input following the sequence shown below:
    Enter your assignment scores (-1 to exit):
    Score 1: 38
    Value of score 1: 40
    Score 2: 41
    Value of score 2: 40
    Score 3: 42
    Value of score 3: 40
    Score 4: 39
    Value of score 4: 40
    Score 5: 43
    Value of score 5: 40
    Score 6: -1
    
    Enter your midterm scores (-1 to exit):
    Score 1: 85
    Value of score 1: 100
    Score 2: -1
    
    Enter your final exam scores (-1 to exit):
    Score 1: 0
    Value of score 1: 0
    Score 2: -1
    

    The numbers after the colon are the user input and your scores will differ of course. However, your program must ask for the score first and the value second. A negative number must exit the grading area and move on to the next area. After the final scores are entered, the program must produce the report shown below. Your program must follow this input sequence exactly or you will get a low grade on the assignment.

  3. After collecting the input, your program must write the following report to the console:
    Assignment Area
    Sum of scores: 203
    Sum of values: 200
    Assignment weight: 0.40
    Assignment weighted average: 0.40
    
    Midterm Area
    Sum of scores: 85
    Sum of values: 100
    Midterm weight: 0.25
    Midterm weighted average: 0.21
    
    Final Area
    Sum of scores: 0
    Sum of values: 0
    Final weight: 0.35
    Final weighted average: 0.00
    
    Sum of weighted averages: 0.61
    Letter grade to date: D
    Sum of weighted averages without final: 0.94
    Letter grade without final: A
    

    Follow this report template exactly. Actual numbers reported depend on the input, of course. Notice that the weighted average cannot be more than the area weight, which is why the assignment is capped at 0.40. You must use the same labels (words to the left of the colon) for each reported number as shown above.

  4. Report decimal results using two decimal places to the right of the decimal point exactly.
  5. Prepare a file named scores.txt containing all your grade data for the course so far. The format of the file must follow the same sequence as the user input described above. When run with input redirection, the scores.txt file must produce the same report as manual entry.
    ./gradebook < scores.txt

    Here is an example file that produced the example output shown above: scores.txt.

  6. Within your program, define the two functions described by the comments and prototypes shown below:
    /**
        Reads the scores from cin using the standard input stream,
        sums the scores and values, and stores the sum of the
        scores and values in the reference parameters.
    
        @param sumScores Sum of all scores entered by the user.
        @param sumValues Sum of all max values entered by the user.
    */
    void readScores(int& sumScores, int& sumValues);
    
    /**
        Converts the percentage to a letter grade.
    
        @param percentage The percentage to convert.
        @return The letter grade.
    */
    char toLetterGrade(double percentage);
    

    You may NOT change the function names, parameters, parameter types or return types.

  7. Your program must define between three and seven functions, including main(), and call all the defined functions at least one time.
  8. Structure your code such that you declare function prototypes before main() and function definitions after main() for all your functions.
  9. The name of the source code file must be gradebook.cpp and all your code must be in this file.

    Be careful of the spelling, including capitalization, as you will lose points for a misspelled name.

  10. Remember to include one file comment block, a function comment block for all function prototypes, and follow all the other style rules we have covered so far.
  11. Your program must follow the same sequence of operations as the example program.
  12. Submit your files to Blackboard as explained in the section of this document: What to Turn In.

Hints

  1. Watch our for dividing by zero. C++ usually displays nan (not a number) when you divide by zero.

Program Testing

Testing is an important part of software development. You need some way to know if your program is working correctly. You can download an executable version of the program using this link: gradebook.exe. You can run this program to see how your code must operate. Remember that you must run this program from the command line:

./gradebook

You can test this program using the example scores.txt and input redirection to verify you get the same output as shown in the specifications above.

./gradebook < scores.txt

Extra Credit

The following are worth extra credit points:

  1. Complete the assignment using pair programming. (1 point)
  2. Add code that returns the score needed on the final exam to get an "A", "B" and "C" grade in the course for the given input files. For example, for the example scores.txt, the program should display: (2 points)
    Score needed on final for A: 82.14%
    Score needed on final for B: 53.57%
    Score needed on final for C: 25.00%
    

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

Tutorial Exercises

  1. Type into a text editor the program product2.cpp from the textbook on pages 221-223, and then compile and run the program. Submit your working source code file to Blackboard for grading using the same file name as the program name.
  2. Complete the Tutorial Exercises in CodeLab 7 before the specified due date. Refer to the assigned reading for the next lesson to help you understand the exercises. Also, you can use the online lecture notes for more information as the notes become available.

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.

Lesson Exercises

  • 2: All lesson exercises attempted and turned in
  • 1: Some lesson exercises completed and turned in
  • 0: No lesson exercises completed or turned in

Program Compilation

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

Program Functionality

  • 10: Demonstrates mastery of the assignment
    • Applies concepts from the lessons appropriately
    • Meets all specifications (see above) with particularly elegant solutions
    • Runs to completion with no abnormal error conditions
    • Generates correct output given correct input
    • Behaves in a reasonable way in response to incorrect data
  • 8: Has all the functionality expected of the assignment
    • Demonstrates many techniques from the lesson
    • Attempts to meet 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
    • Attempts to meet 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
    • Attempts to meet 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
    • Attempts to meet 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

Program Style

  • 4: Code is well-documented including:
  • 3: Code has a minor documentation error
  • 2: Code has some documentation errors
  • 1: Code has many documentation errors
  • 0: No apparent attempt to follow documentation standards or write documentation comments

CodeLab and Other Tutorial Exercises

  • Number CodeLab completed correctly / number exercises * 8 and rounded up to the nearest integer.
  • -1 if the product2.cpp file does not compile
  • -2 if the product2.cpp file is not turned in

README.txt File

  • 2: README.txt file submitted following the instructions
  • 1: README.txt file submitted but some information was missing
  • 0: No README.txt file submitted

Total possible: 30, plus extra credit

What to Turn In

Submit your assignment to Blackboard, in the assignment folder that matches the name of this assignment, following the instructions for submitting homework. Include the following items for grading:

  1. README.txt file
  2. All the exercise files from Lesson 7
  3. gradebook.cpp
  4. scores.txt with your score information
  5. product2.cpp (from textbook)

You must submit all the files needed to complete your assignment. Do not assume that the instructors has any files. Your assignment must work as submitted.

Home | Blackboard | Announcements | Day Schedule | Eve Schedule
Course info | Help | FAQ's | HowTo's | Links
Last Updated: March 22 2009 @18:41:25