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,27 @@

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

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

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

public Boolean startsWith(String string, Character character) {
return null;
if(string.startsWith(String.valueOf(character))) {
return true;
}return false;
}

}
Original file line number Diff line number Diff line change
@@ -1,19 +1,40 @@
package com.zipcodewilmington.assessment2.part1;

import java.util.Arrays;

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

public Integer[] range(int start, int stop) {
return null;
Integer[] array = new Integer[]{};
Integer[] copy2 = new Integer[]{};

return copy2 = Arrays.copyOfRange(array, start, stop);
}

public Integer getSumOfFirstTwo(Integer[] array) {
return null;
Integer[] slice = Arrays.copyOfRange(array, array[0], array[1]);
int sumOfFirstTwo = 0;
for(int i = 0; i < slice.length; i++ ){
sumOfFirstTwo+= i;
}

return sumOfFirstTwo;
}

public Integer getProductOfFirstTwo(Integer[] array) {
return null;
Integer[] slice = Arrays.copyOfRange(array, array[0], array[1]);
int prodOfFirstTwo = 0;
for(int i = 0; i < slice.length; i++){
prodOfFirstTwo *= i;
}
return prodOfFirstTwo;
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
package com.zipcodewilmington.assessment2.part1;

public class WuTangConcatenator {
public Integer Wu;
public Integer Tang;
public Integer WuTang;
public Integer value;

public WuTangConcatenator(Integer input) {
}

public Boolean isWu() {
return null;
if (value % 3 == 0) {
value = Wu;
return true;
}
return false;
}

public Boolean isTang() {
return null;
if (value % 5 == 0) {
value = Tang;
return true;
}
return false;
}

public Boolean isWuTang() {
return null;
if (WuTang % 3 == 0 && WuTang % 5 ==0) {
value = WuTang;
return true;
}
return false;
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,74 @@
package com.zipcodewilmington.assessment2.part2;

import com.sun.tools.javac.util.ArrayUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class ArrayUtility {
public Integer[] merge(Integer[] array1, Integer[] array2) {
return null;
List<Integer> merged = new ArrayList<>();

for (int i=0; i<array1.length; i++){
merged.add(array1[i]);
}

for (int i=0; i<array2.length; i++){
merged.add(array2[i]);
}

Collections.sort(merged);
Integer[] result=new Integer[merged.size()];
for (int i=0; i<merged.size(); i++){
result[i]=merged.get(i);
}
return result;
}

public Integer[] rotate(Integer[] array, Integer index) {
return null;
}

public Integer countOccurrence(Integer[] array1, Integer[] array2, Integer valueToEvaluate) {
return null;
int n = 0;
for(Object to : array1){
if(to.equals(valueToEvaluate))
n += 1;
}

return n;
}

public Integer mostCommon(Integer[] array) {
return null;

Arrays.sort(array);
int max_count = 1, res = array[0];
int curr_count = 1;

for (int i = 1; i < array.length; i++)
{
if (array[i] == array[i - 1])
curr_count++;
else
{
if (curr_count > max_count)
{
max_count = curr_count;
res = array[i - 1];
}
curr_count = 1;
}
}


if (curr_count > max_count)
{
max_count = curr_count;
res = array[array.length - 1];
}

return res;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
import java.util.List;

public class ListUtility {
ListUtility utility;
public Boolean add(int i) {
return null;
utility.add(i);
utility.contains(i);
return true;
}

public Integer size() {
return null;
Integer result = utility.size();
return result;
}

public List<Integer> getUnique() {
Expand All @@ -24,6 +28,8 @@ public Integer mostCommon() {
}

public Boolean contains(Integer valueToAdd) {
return null;
utility.add(valueToAdd);
utility.contains(valueToAdd);
return true;
}
}