CW/HWArray handout 2
public static void printBackwards(String[] people)
public static boolean isInList(int[] list, int num) // check if num is in list
public static int count(int[] list, int num)// count occurrences of num
public static boolean hasNegatives(int[] list) // check if list contains negatives
public static boolean hasAMatchingPair(int[] list)
// check if any matching pairs, assume even number elements
public static boolean allMatchingPairs(int[] list)
// check if all matching pairs, assume even number elements
public static boolean isIncreasing(int[] list)
// check if all numbers in list are greater than previous number
public static void replaceVowels(char[] list, char replace)
//replace all vowels with the character variable replace
public static void shiftRight(int[] list)
//shift all elements of list one to the right, shift the last element to the front
TUE
1) review HW array handout
2) continue MagicSquare.java
change
int[] list = new list[6]; // should have been 8
to
int[] list = new list[(table.length * 2) + 2)];
version 1: we will not use loops in isMagic method (assume 3 by 3 square)
version 2: add isUnique method
3) HW any 1 javabat from Arrays-1 and any 1 javabat from Arrays-2
WED
Array Quiz 1 (only 1 dimensional arrays)
THERE WILL BE NO RE-TEST
Be able to
- declare an array of any data type, of any size using the new operator
- declare an array using an initializer list
- access individual elements in an array, such as the first or last
- access pairs of elements without going past the end of an array
- print an array forwards or backwards
- check if an array has any elements (if the length is greater than 0)
- loop through an array to find
- the largest or smallest number
- the presence of a particular number
- the sum
- check for matching pairs
- return a count such as the number of times a specified number appears in a list
- if an array is in increasing order
- be able to the contents of one list to another
- be able to replace specific elements of a list
- any problems from Array Handout 1 and 2
THU
continue MagicSquare.java
version 3: modify so that it will work with a magic square of any size
FRI
finish and hand in MagicSquare.java