You may work on this part of the lab practical exam for two hours, during your regularly scheduled lab time and only in the lab under the supervision of your lab TA. Sign-in and sign-out is required. Any commits made outside your lab time will be disregarded, and may subject you to academic integrity violation proceedings.
Two additional tasks are given below: incorporation of some buggy code attempting to implement a new feature, and the specification of a new feature to add (but with no implemetatation).
You are not required to carry out these tasks. They are provided so that you can fill in any gaps in the process and tool evidence you gathered during part 1. If you believe you have provided sufficient evidence in part 1, or if you wish to add and strengthen the process and tool evidence that you are providing for by continuing the work you did for part 1, you may of course do that.
You may use any prior work you have done for this course (any earlier LEXes, PRE, EXP01, EXP02, POST, LPR1), any tool documentation, etc. You may ask TAs (but not other students) questions during the lab practical, though they cannot answer all questions: this is an exam after all.
IMPORTANT: Be sure to include a link to your kanban board in a file named kanban.txt
A co-worker wrote code for the project. To incorporate this into your repo first create a new branch, called "toStringFeature", in your repo from last time. Download the lpr2.zip file and add and commit this code to your new branch, then push the branch and the code it contains to your repo.
This code is a mess. It doesn't implement all the required functionality, it has some non-required functionality stubbed out. It segfaults and it leaks memory. BUT, it attempts to incorporate a really important feature that wasn't included in the original specs: it can produce textual representations of things like ingredients using a toString function that returns a char *. Your manager wants you to clean it up. The first thing you must do (and document via Kanban cards) is to address the segfault (use gdb to track it down and fix it) and the memory leaks (use memcheck from the valgrind suite to document the memory leaks, and demonstrate some progress in eliminating the leaks) in that code.
A MealPlan is a set of three recipes (one for breakfast, one for lunch, one for dinner). Note that the actual foods in each recipe is not important (you could have steak for breakfast, cake for lunch, and cereal for dinner).
Define a function mealPlan(pantry, book, limit1, limit2, limit3, min, max) which must return a single MealPlan such that the calorie count of recipe 1 is ≤ limit1, the calorie count of recipe 2 is ≤ limit2, the calorie count of recipe 3 is ≤ limit3, and the sum of the calorie counts of all three recipes is ≥ min and ≤ max. For example, mealPlan(pantry, book, 1000, 1000, 1000, 1800, 2100) must return a meal plan whose total calorie count is between 1800 and 2100, and whose meals are all individually ≤ 1000. For example, no breakfast, an 800 calorie lunch, and a 1000 calorie dinner would be acceptable.
ADVICE
b = newBook();
r = newRecipe("Tea, Earl Grey, hot", 1);
i = newIngredient("Water", 0);
str2 = toString(i);
printf("Ingredient: %s\n",str2);
addIngredient(r, i, 240);
i = newIngredient("Earl Grey tea", 1);
str2 = toString(i);
printf("Ingredient: %s\n",str2);
addIngredient(r, i, 2);
addRecipe(b, r);