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
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,32 @@

public class BasicUtilities {
public Boolean isGreaterThan5(Integer value) {
return null;
if (value >= 5) {
return true;
}
else
return false;
}

public Boolean isLessThan7(Integer value) {
return null;
if (value <= 7) {
return true;
} else
return false;
}

public Boolean isBetween5And7(Integer valueToEvaluate) {
return null;
if (valueToEvaluate >= 5 && valueToEvaluate <= 7) {
return true;
} else
return false;
}

public Boolean startsWith(String string, Character character) {
return null;
char[] newArray = string.toLowerCase().toCharArray();
if (newArray[0] == Character.toLowerCase(character)) {
return true;
} else
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,27 @@

public class IntegerArrayUtilities {
public Boolean hasEvenLength(Integer[] array) {
return null;
if (array.length % 2 == 0) {
return true;
}
return false;
}

public Integer[] range(int start, int stop) {
return null;
Integer[] arrayToReturn = new Integer[stop - start + 1];
int index = 0;
for (int i = start; i <= stop; i++) {
arrayToReturn[index] = i;
index++;
}
return arrayToReturn;
}

public Integer getSumOfFirstTwo(Integer[] array) {
return null;
return array[0] + array[1];
}

public Integer getProductOfFirstTwo(Integer[] array) {
return null;
return array[array.length - 1] * array[array.length - 2];
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
package com.zipcodewilmington.assessment2.part1;

public class WuTangConcatenator {

Integer a = 0;

public WuTangConcatenator(Integer input) {
this.a = input;
}

public Boolean isWu() {
return null;
return a % 3 == 0;
}

public Boolean isTang() {
return null;
return a % 5 == 0;
}

public Boolean isWuTang() {
return null;
return a % 3 == 0 && a % 5 == 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,33 @@

public class ArrayUtility {
public Integer[] merge(Integer[] array1, Integer[] array2) {
return null;
Integer[] toReturn = new Integer[array1.length + array2.length];
int index = 0;
for (Integer integer : array1) {
toReturn[index] = integer;
index++;
}

for (Integer integer : array2) {
toReturn[index] = integer;
index++;
}
return toReturn;
}

public Integer[] rotate(Integer[] array, Integer index) {
/*Integer[] toReturn = new Integer[array.length];
Integer[] temp = new Integer[index];
int dex = 0;
for (int i = 0; i < temp.length; i++) {
temp[i] = array[i];
}

for (int i = 0; i < ; i++) {

}

return merge(temp, array);*/
return null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,53 @@
package com.zipcodewilmington.assessment2.part2;

import java.util.ArrayList;
import java.util.List;

public class ListUtility {

List<Integer> list = new ArrayList<>();

public Boolean add(int i) {
return null;
list.add(i);
if (list.contains(i)) {
return true;
} else
return false;
}

public Integer size() {
return null;
return list.size();
}

public List<Integer> getUnique() {
/* List<Integer> toReturn = new ArrayList<>();
Integer lastSeen = 0;
for (Integer element : list) {
lastSeen = element;
for (Integer index : list) {
if ()
}
}*/
return null;
}

public String join() {
return null;
String toReturn = "";
/* for (int i = 0; i < list.size(); i++) {
toReturn += list.get(i);
if
}*/
return toReturn;
}

public Integer mostCommon() {
return null;
}

public Boolean contains(Integer valueToAdd) {
return null;
if (list.contains(valueToAdd)) {
return true;
} else
return false;
}
}
22 changes: 20 additions & 2 deletions src/main/java/com/zipcodewilmington/assessment2/part2/Router.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
package com.zipcodewilmington.assessment2.part2;

import java.util.LinkedHashMap;
import java.util.Map;

public class Router {

LinkedHashMap<String, String> routerPaths = new LinkedHashMap<>();

public void add(String path, String controller) {
routerPaths.put(path, controller);
}

public Integer size() {
return null;
return routerPaths.size();
}

public String getController(String path) {
return null;
return routerPaths.get(path);
}

public void update(String path, String studentController) {
routerPaths.put(path, studentController);
}

public void remove(String path) {
routerPaths.remove(path);
}

@Override
public String toString() {
String stringToReturn = "";
for (Map.Entry<String, String> element : routerPaths.entrySet()) {
stringToReturn += (element.getKey() + " -> " + element.getValue());
}
return stringToReturn;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.zipcodewilmington.assessment2.part3;

public class Bird {
public abstract class Bird implements Animal{
public String move() {
return null;
return "fly";
}

public void setMigrationMonth(String expected) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
package com.zipcodewilmington.assessment2.part3;

public class BlueJay {
public class BlueJay extends Bird{
@Override
public int getSpeed() {
return 13;
}

@Override
public String color() {
return "blue";
}
}
16 changes: 15 additions & 1 deletion src/main/java/com/zipcodewilmington/assessment2/part3/Horse.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package com.zipcodewilmington.assessment2.part3;

public class Horse{
public class Horse implements Animal{
@Override
public String move() {
return "gallop";
}

@Override
public int getSpeed() {
return 40;
}

@Override
public String color() {
return "brown";
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
package com.zipcodewilmington.assessment2.part3;

public class RedRobin {
public class RedRobin extends Bird{

String migrationMonth;

@Override
public String getMigrationMonth() {
return migrationMonth;
}

@Override
public void setMigrationMonth(String migrationMonth) {
this.migrationMonth = migrationMonth;
}

@Override
public int getSpeed() {
return 10;
}

@Override
public String color() {
return "red";
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
package com.zipcodewilmington.assessment2.part3;

public class SpeedComparator {
import java.util.Comparator;

public class SpeedComparator implements Comparator<Animal> {
@Override
public int compare(Animal animal1, Animal animal2) {
if (animal1.getSpeed() == animal2.getSpeed()) {
return 0;
} else if (animal1.getSpeed() > animal2.getSpeed()) {
return -1;
} else {
return 1;
}
}
}