1. int totalTime() { int total = 0; for (int c = 0; c < getCityCount()-1; c++) { Trip trip(getCity(c), getCity(c+1)); total += trip.getTravelTime(); } Trip trip( getCity(getCityCount()-1), getCity(0) ); // back home total += trip.getTravelTime(); return total; } 2. int maxIndex; int maxSlices = 0; for (int p = 0; p < prgmCount; p++) { if (prgm[p].slicesEaten() > maxSlices) { maxSlices = prgm[p].slicesEaten(); maxIndex = p; } } prgm[maxIndex] = prgm[prgmCount-1]; prgmCount--; 3. for (int f = 0; f < foodCount; f++) { bool allergies = false; for (int g = 0; g < guestCount; g++) { if (guests[g].isAllergicTo(foods[f])) { allergies = true; break; // not required for correct answer // but runs faster! } } if (!allergies) foods[f].display(); } 4. double aveRain(char name[MAXNAMELEN]) { int cityRow; for (int c = 0; c < cityCount; c++) { if (strcmp(name,cities[c]) == 0) { cityRow = c; break; } } int total = 0; for (int d = 0; d < dayCount; d++) { total += rainfall[cityRow][d]; } return total / dayCount; } // 2nd loop could be placed inside the if 5. 7,9 m&n sent to funW, but only the second of funW's parameters is a reference parameter; only n is increased. 5,5,6 whole array is given to funY and funY can change anything funY changes the first element (4->5) funY calls funX which receives a copy of second element, so second element, array[1], is not modified 6. parameters: any 2 of a,b,c,array locals: any 2 of m, n there are NO data members the are NO globals