Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 list) {

//to be completed

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions