Question
Help with these two Java methods please * @param str: assume it's not null * @param start: starting index (assume 0
Help with these two Java methods please
* @param str: assume it's not null
* @param start: starting index (assume 0 <= start < str.length())
* @param end: ending index (assume 0 <= end < str.length())
* @return true if string is numeric from start to end.
* return true if start > end
*
* HINT: you can check a character ch is a digit by checking
* Character.isDigit(ch) and similarly that it's not a digit using
* !Character.isDigit(ch)
* for example,
* if str = "hello world!", start = 0, end = 11, return false
* if str = "hello world!", start = 6, end = 4, return true
* if str = "0123456789", start = 0, end = 9, return true
* if str = "+5678", start = 1, end = 3, return true
* if str = "+5678", start = 0, end = 3, return false
*/
public static boolean isNumeric(String str, int start, int end) {
return false; //to be completed
}
/**
* @param list
* remove any duplicates from the list, retaining only the last occurrence of
* every item in the list
* if list = [1,2,1,3,7,4,5,7,7,7], it should become [2,1,3,4,5,7]
* if list = [8,8,8,8], it should become [8]
* if list = [1,2,7], it should stay [1,2,7]
*/
public static void removeDuplicates(ArrayList
//to be completed
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started