Question: /** * Returns true if and only if each string in the supplied list of strings * starts with an uppercase letter. If the list

/**

* Returns true if and only if each string in the supplied list of strings

* starts with an uppercase letter. If the list is empty, returns false.

*

* @param l a non-null list of strings

* @return true iff each string starts with an uppercase letter

*/

public static boolean allCapitalizedWords(List l) {

int j = 0;

for(String string : l) {

char letter = string.charAt(0);

if(!Character.isUpperCase(letter)) {

j = 0;

break;

}

}

if(j == 0) {

return true;

}

else {

return false;

}

} =================================

/**

* Inserts a string into a sorted list of strings, maintaining the sorted property of the list.

*

* @param s the string to insert

* @param l a non-null, sorted list of strings

*/

public static void insertInOrder(String s, List l) {

}

using get, set, add, size and the like instead of the array index operators []. For allCapitalizedWords, you may find Character.isUpperCasehelpful. For insertInOrder, you can use String.compareTo to determine which string comes first. If you have two strings s1 and s2, use s1.compareTo(s2) < 0 to check if s1 comes before s2.

Thank you!!!!!!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!