Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
<groupId>io.zipcoder</groupId>
<artifactId>Interfaces</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
Expand All @@ -15,5 +27,10 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.zipcoder</groupId>
<artifactId>Interfaces</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
8 changes: 8 additions & 0 deletions src/main/java/io/zipcoder/Animal.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.zipcoder;

/**
* created by Frankie on 02/26/18
*/
public interface Animal {
String speak();
}
64 changes: 64 additions & 0 deletions src/main/java/io/zipcoder/Application.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,69 @@
package io.zipcoder;


import java.util.*;

//April
/**
* Tests made by Frankie Rodriguez on 02/26/18
*/

public class Application {
private String nameOfPet;
private String typeOfPet;
private Integer amountOfPets;


ArrayList<Pet> petList = new ArrayList<>();

public Application() {
}

public Application(String typeOfPet, String nameOfPet) {
this.typeOfPet = typeOfPet;
this.nameOfPet = nameOfPet;
}

public void welcomeUser() {
System.out.println("******************** WELCOME PET OWNER **********************\n" +
"We will be asking you a couple of questions about your pets.\n" +
"No need to worry. We won't be doing anything sketchy with\n" +
"this info. Your pet info is safe with us :) \n");
}

public String getNameOfPet() {
Scanner input = new Scanner(System.in);
System.out.println("What is it's name?");
return input.nextLine();
}

public String getTypeOfPet() {
Scanner input = new Scanner(System.in);
System.out.println("What kind of pet is it?");
return input.nextLine();
}

public Integer howManyPetsYouGotDamn() {
Scanner input = new Scanner(System.in);
System.out.println("How many pets do you have?\n\nEnter the amount of pets: ");
return input.nextInt();

}

public ArrayList<Pet> fillList(String nameOfPet, String typeOfPet) {
petList.add(new Pet());
return petList;
}


public static ArrayList<Pet> sortList(ArrayList<Pet> petList) {
Collections.sort(petList, (Pet petOne, Pet petTwo)-> petOne.getName().compareTo(petTwo.getName()));
return petList;

}



}


27 changes: 27 additions & 0 deletions src/main/java/io/zipcoder/Cat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.zipcoder;

public class Cat extends Pet implements Animal{
private String name;
private Cat cat;

public Cat() {
this.name = "";
}

public Cat(String name){
this.name = name;
}

public String getName() {
return name;
}

public String speak() {
Animal cat = new Animal() {
public String speak() {
return "Meow (ever so softly)";
}
};
return cat.speak();
}
}
9 changes: 9 additions & 0 deletions src/main/java/io/zipcoder/ComparePets.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.zipcoder;

import java.util.Comparator;

public class ComparePets implements Comparator<Pet> {
public int compare(Pet p1, Pet p2) {
return p1.getName().compareTo(p2.getName());
}
}
27 changes: 27 additions & 0 deletions src/main/java/io/zipcoder/Dog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.zipcoder;

public class Dog extends Pet implements Animal{
private String name;
private Dog dog;

public Dog() {
this.name = "";
}

public Dog(String name) {
this.name = name;
}

public String getName() {
return name;
}

public String speak() {
Animal dog = new Animal(){
public String speak() {
return "Woof!";
}
};
return dog.speak();
}
}
28 changes: 28 additions & 0 deletions src/main/java/io/zipcoder/ElectricMouse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.zipcoder;

public class ElectricMouse extends Pet implements Animal{
private String name;
private ElectricMouse electricMouse;

public ElectricMouse() {
this.name = "";
}

public ElectricMouse(String name) {
this.name = name;
}

public String getName() {
return name;
}

@Override
public String speak() {
Animal electricMouse = new Animal() {
public String speak() {
return "PIKACHUUUUUUUU!";
}
};
return electricMouse.speak();
}
}
29 changes: 29 additions & 0 deletions src/main/java/io/zipcoder/Pet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.zipcoder;

public class Pet {
private String name;
private Dog dog;
private Cat cat;
private Turtle turtle;
private ElectricMouse electricMouse;
public String typeOfPet;

public Pet(){
this.name = "";
this.typeOfPet = "";
}

public Pet(String name, String typeOfPet) {
this.name = name;
this.typeOfPet = typeOfPet;
}

public String speak(){
return "Meow (ever so softly)";
}

public String getName() {
return name;
}

}
28 changes: 28 additions & 0 deletions src/main/java/io/zipcoder/Turtle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.zipcoder;

public class Turtle extends Pet implements Animal{
private String name;
private Turtle turtle;

public Turtle() {
this.name = "";
}

public Turtle(String name) {
this.name = name;
}

public String getName() {
return name;
}


public String speak() {
Animal turtle = new Animal() {
public String speak() {
return "WEEESNAW!";
}
};
return turtle.speak();
}
}
Loading