CIS-2271 Homework #7: Methods Revisited

Due: Tuesday, October 8, 2013

Write methods that do the following things. You can put all of these methods into a single program for easy organization. I'm not specifically requiring you to write a main method but you might want to just to test the methods below (by calling them).

  1. A method findMax that takes an array of integers and returns the maximum integer in the array.

  2. A method findString that takes an array of strings and a search string (in other words, two parameters) and returns the index in the array of the first string that matches the search string. Return -1 if there is no match. Be sure to use the equals to compare string values.

  3. A method flip that takes an array of integers and returns them in reverse order. For example if given an array { 1, 2, 3 } it should modify it to contain { 3, 2, 1 }. Your method should change the array in place (technically the method returns void).

  4. A method flipNonMutating that works like flip except that it should not change the given array and instead return a new array with everything in reverse order.

Last Revised: 2013-10-01
© Copyright 2013 by Peter C. Chapin <>