Skip to content

Commit

Permalink
Sixth Commit - Working / Fixed // Need two additional looping constructs
Browse files Browse the repository at this point in the history
  • Loading branch information
wrainaud committed Oct 7, 2020
1 parent ab0c8eb commit 7bf5839
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 40 deletions.
38 changes: 0 additions & 38 deletions CS503_HW1/src/edu/monmouth/CS503/s0833836/CS503HW1/AnimalList.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
package edu.monmouth.CS503.s0833836.CS503HW1;

public class AnimalTester {

final int ARRAYSIZE = 20;
Animal[] list = new Animal[ARRAYSIZE];
public int counter = 0;

public void addDog(String inFurColor) {
Dog newDog = new Dog(inFurColor);
list[counter] = newDog;
counter++;
}//addDog

public void addFish(String inColor) {
Fish newFish = new Fish(inColor);
list[counter] = newFish;
counter++;
}//addFish

public void addGuardDog(String inFurColor, short inMeanness) {
GuardDog newGuardDog = new GuardDog(inFurColor, inMeanness);
list[counter] = newGuardDog;
counter++;
}//addGuardDog

public void addShowDog(String inFurColor, String inBreed) {
ShowDog newShowDog = new ShowDog(inFurColor, inBreed);
list[counter] = newShowDog;
counter++;
}//addShowDog

public void printList() {
for (int newCounter = 0; newCounter < counter; newCounter++) {
System.out.println(list[newCounter].toString());
}//for
}//printList

public static void main(String[] args) {

Expand All @@ -12,7 +46,7 @@ public static void main(String[] args) {
fish.move();
fish.makeSound();

AnimalList test1 = new AnimalList();
AnimalTester test1 = new AnimalTester();
test1.addDog("Black");
test1.addDog("Gold");
test1.addDog("Yellow");
Expand Down Expand Up @@ -40,5 +74,6 @@ public static void main(String[] args) {
test1.printList();

}//main

}//AnimalTester

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public void makeSound() {
System.out.println(makeDogSound);
}//makeSound

//@Override
public String toString() {
return "Dog - " + "Fur Color: " + furColor + " ";
}//toString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public void makeSound() {
System.out.println(makeFishSound);
}//makeSound

//@Override
public String toString() {
return "Fish - " + "Color: " + color + " ";
}//toString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ public GuardDog(String inFurColor, short inMeanness) {
super(inFurColor);
meanness = inMeanness;
}//ShowDog


//@Override
public short getMeanness() {
return meanness;
}//getMeanness

//@Override
public void setMeanness(short meanness) {
this.meanness = meanness;
}//setMeanness

//@Override
public String toString() {
return "Guard Dog - " + "Fur Color: " + super.getFurColor() + ". Meanness: " + meanness + " ";
}//toString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ public ShowDog(String inFurColor, String inBreed) {
breed = inBreed;
}//ShowDog

//@Override
public String getBreed() {
return breed;
}//getBreed

//@Override
public void setBreed(String breed) {
this.breed = breed;
}//setBreed

//@Override
public String toString() {
return "Show Dog - " + "Fur Color: " + super.getFurColor() + ". Breed: " + breed + " ";
}//toString
Expand Down

0 comments on commit 7bf5839

Please sign in to comment.