1A) double findPrice(char nm[]) { char prodName[MAX]; for (int p = 0; p < prodCount; p++) { prods[p].getName(prodName); if (strcmp(prodName,nm) == 0) { return prods[p].getPrice(); // or return prices[p]; } } } 1B) double totalCost() { double total = 0; char nm[MAX]; for (int p = 0; p < prodCount; p++) { prods[p].getName(nm); total += priceList.findPrice(nm) * quantities[p]; } return total; } 2 void copyRectangle(int startRow, int startCol, int endRow, int endCol, int numRows, int numCols) { for (int r = 0; r < numRows; r++) { for (int c = 0; c < numCols; c++) { arr[endRow+r][endRow+c ] = arr[startRow+r][startCol+c]; } } } 3. Registrar reg; Student smith = reg.getStudent("Smith"); Course crses[MAX]; int courseCount; Time early(9,0); courseCount = reg.getCourses(crses); for (int c = 0; c < courseCount; c++) { if (crses[c].getDeptID() == 13) { if (crses[c].getStartTime().isAfter(early)) // vs. 9:00 or later reg.enroll(smith,crses[c]); } } 4. data members: x, y locals: w, z, k parameters: d, e, argCount 5. - parameter of fun1 is not a reference parameter pt1 is therefore unchanged 10 20 - parameter of fun2 IS a ref. param. pt2 is modified 14 40 - parameter of funB is not a ref. param. pt3 is unchanged 50 60 - parameter of funD is a ref. param. also parameter of funC is a ref. param. both funD and funD can modify pt4 -140 80