Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 9 commits into
base: feedback
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>com.zipcodewilmington.assessment1</groupId>
<artifactId>question1</artifactId>
<artifactId>assessment1</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,34 @@ public class BasicArrayUtils {
* @return the first element in the array
*/
public static String getFirstElement(String[] stringArray) {
return null;
String[] stringFirstArray;
return stringArray[0];
}

/**
* @param stringArray an array of String objects
* @return the second element in the array
*/
public static String getSecondElement(String[] stringArray) {
return null;
String[] stringSecondArray;
return stringArray[1];
}

/**
* @param stringArray an array of String objects
* @return the last element in the array
*/
public static String getLastElement(String[] stringArray) {
return null;
String[] stringLastArray;
return stringArray[stringArray.length - 1];
}

/**
* @param stringArray an array of String objects
* @return the second to last element in the array
*/
public static String getSecondToLastElement(String[] stringArray) {
return null;
String[] stringSecondToLastArray;
return stringArray[stringArray.length - 2];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,25 @@ public class BasicStringUtils {
* @return string with identical content, and the first character capitalized
*/
public static String camelCase(String str) {
return null;
String strCamel;
return str.substring(0,1).toUpperCase() + str.substring(1);
}

/**
* @param str string input from client
* @return string with identical contents, in the reverse order
*/
public static String reverse(String str) {
return null;
String strReverse;
return new StringBuilder(str).reverse().toString();
}

/**
* @param str string input from client
* @return string with identical contents, in reverse order, with first character capitalized
*/
public static String reverseThenCamelCase(String str) {
return null;
String strReverseCamel;
return new StringBuilder(str).reverse().toString().toUpperCase();
}


Expand All @@ -34,14 +36,17 @@ public static String reverseThenCamelCase(String str) {
* @return string with identical contents excluding first and last character
*/
public static String removeFirstAndLastCharacter(String str) {
return null;
String strF;
return str.substring(1, str.length()-1);
}

/**
* @param str a string input from user
* @return string with identical characters, each with opposite casing
*/
public static String invertCasing(String str) {
String invertC;

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,39 @@
public class IntegerArrayUtils {
/**
* @param intArray an array of integers
* @return the sum of `intArray`
* @return
*/
public static Integer getSum(Integer[] intArray) {
return null;
int sum = 0;
int i;
for (i = 0; i < intArray.length; i++){
sum += intArray[i];
}
return sum;
}

/**
* @param intArray an array of integers
* @return the product of `intArray`
*/
public static Integer getProduct(Integer[] intArray) {
return null;
int product = 1;
for (int i = 0; i < intArray.length; i++) {
product *= intArray[i];
}
return product;
}

/**
* @param intArray an array of integers
* @return the sum of `intArray` divided by number of elements in `intArray`
*/
public static Double getAverage(Integer[] intArray) {
return null;
int sum = 0;
int i;
for (i = 0; i < intArray.length; i++){
sum += intArray[i] ;
}
return (double) sum / intArray.length;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static Integer getSumOfN(Integer n) {
return null;
}


/**
* @param n integer value input by client
* @return the product of all integers between 0 and not including `n`
Expand All @@ -26,7 +27,5 @@ public static Integer getProductOfN(Integer n) {
* @param val integer value input by client
* @return integer with identical digits in the reverse order
*/
public static Integer reverseDigits(Integer val) {
return null;
}
public static Integer reverseDigits(Integer val) {return null;}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
*/
public interface Animal {
String speak();

}