Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/** * 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

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

Students also viewed these Databases questions

Question

=+f. Do you think this Fed chairman was a good appointment?

Answered: 1 week ago