diff --git a/CS503_HW1/src/edu/monmouth/CS503/s0833836/CS503HW1/AnimalTester.java b/CS503_HW1/src/edu/monmouth/CS503/s0833836/CS503HW1/AnimalTester.java index 44218f9..7084a4d 100644 --- a/CS503_HW1/src/edu/monmouth/CS503/s0833836/CS503HW1/AnimalTester.java +++ b/CS503_HW1/src/edu/monmouth/CS503/s0833836/CS503HW1/AnimalTester.java @@ -35,6 +35,20 @@ public void printList() { System.out.println(list[newCounter].toString()); }//for }//printList + + public void printEvenElementsList() { + for (int newCounter = 0; newCounter < counter; newCounter++) { + if(newCounter % 2 == 0) { + System.out.println(list[newCounter].toString()); + }//if + }//for + }//printList + + public void printReverseList() { + for (int newCounter = -1; newCounter > counter; newCounter--) { + System.out.println(list[newCounter].toString()); + }//for + }//printList public static void main(String[] args) { @@ -70,8 +84,21 @@ public static void main(String[] args) { test1.addShowDog("Yellow", "Great Dane"); test1.addShowDog("Brown", "French Bulldog"); test1.addShowDog("Charcoal", "Dobermann"); - + + System.out.println(""); + System.out.println("Full List of Animals"); + System.out.println(""); test1.printList(); + + System.out.println(""); + System.out.println("Every Even Animal in the Array"); + System.out.println(""); + test1.printEvenElementsList(); + + System.out.println(""); + System.out.println("Every Animal in the Array in Reverse Order"); + System.out.println(""); + test1.printReverseList(); }//main