You know, since you are setting caloriesOfHighest to 0 initially, and we can assume you will never have an item with negative calories, your first if statement would actually cover the situation...
Type: Posts; User: aussiemcgr
You know, since you are setting caloriesOfHighest to 0 initially, and we can assume you will never have an item with negative calories, your first if statement would actually cover the situation...
Ok, very good. Now, let's look at your requirements for this method:
So our goals for this method are:
1. Add calories to the totalCalories instance variable
2. Increment the count of items...
Ok, well first of all, take out the code in your addToCounter() method where you are setting the parameter values:
calories = 900;
// and
itemName = "Subway BMT Italian Sandwich";
// and ...
I'm confused. What is wrong with the addToCounter() method? I am noticing that you are pretty much ignoring the values of the parameters you pass into the method (since you are setting their values...