|
|||
Home
Syllabus
Calendar
Weekly Schedule
Getting Help
Homework Academic Integrity
C++ Development
References |
Homework Grading CriteriaPoints for programming assignments are awarded for error-free compilation, correct program output, and overall program structure. The program structure grade is an evaluation of the quality of your code. This includes the following:
Use the example code given in class, in lab, and in the textbooks as guidelines. Programs that are unclear and do not compile will earn little or no credit. Program correctness will be determined by evaluating your program on a series of test data sets. We will make available some but not all of this data, along with sample output, prior to the assignment due date. This will help you judge the quality of your program, but will not guarantee correct results on all data. You will need to ensure this on your own by creating additional test cases. Examples of CommentingMost functions should have at least one comment (usually at the top) explaining what the function does. And functions of more than a couple lines should have addtional comments explaining the logic within the function body. Of course, in some situations, a function does not need comments (when the function's behaviour is obvious). We suggest you avoid adding comments that do not help in the understanding of the program. For example: string getNameOfRecipe() { // function that gets the name of the recipe } The comment above is not useful (it is obvious that getNameOfRecipe() is a function and it is obvious that it returns the name of the recipe). However, if the name of the function was getNR() it would be useful to add comments explaining that this function returns the name of the recipe. NOTE: It is better to use a descriptive name for the function than rely on comments! Another example: double getRoot(double a,double b, double c) { // get root function double d; // declare d as a double d = b*b - 4*a*c; double root = (-b + sqrt( d ))/(2*a); // compute the root return root; // return the result } The comments above are also not useful (it is obvious that the return statement returns something; it is obvious that this is the "get root function"). Here is a much more informative commenting of the same code: // This functions receives the coefficients of an equation in the form // ax2+bx+c=0 and returns one of its roots. // Attention: We assume that the equation has at least one real root. double getRoot(double a,double b, double c) { double delta = b*b - 4*a*c; // We use Bhaskara's formula to compute one of the roots double root = (-b + sqrt( delta ))/(2*a); return root; }
See also the main Course Grades page, the Homework page, and the Programming Advice from TAs page for more information. |