Question: package hw 1 ; public class HW 1 { / * * * Determines if the words in a charArray appear in sorted order *

package hw1;
public class HW1{
/**
* Determines if the words in a charArray appear in sorted order
*
* @param charArray An array of letters containing multiple words separated by
* space characters. All letters are lower case.
* @return {@code true} if the words appear in alphabetical order and
*{@code false} otherwise.
*/
public static boolean wordsInOrder(char[] charArray){
// TODO
// Modify the body of this method so that it behaves as outlined in the
// javadoc comments.
return false;
}
/**
* Determines if any of the words in a charArray appear more than once.
*
* @param charArray An array of letters containing multiple words separated by
* space characters. All letters are lower case.
* @return {@code true} if there is at least one word that appears more than
* once and {@code false} otherwise.
*/
public static boolean containsDuplicates(char[] charArray){
// TODO
// Modify the body of this method so that it behaves as outlined in the
// javadoc comments.
return false;
}
/**
* Determines if there are more positive numbers or more negative numbers in a
* given array.
*
* @param numbers the array of numbers to be checked
* @return a positive number if the array contains more positive numbers than
* negative numbers, a negative number if the array contains more
* negative numbers than positive numbers, or zero if the array contains
* the same number of positive numbers as negative numbers
*/
public static int sign(int[] numbers){
// TODO
// Modify the body of this method so that it behaves as outlined in the
// javadoc comments.
return 0;
}
/**
* Returns the number of even ints in an array.
*
* @param a an array of ints
* @return the number of even ints in the array
*/
public static int countEvens(int[] a){
// TODO
// Modify the body of this method so that it behaves as outlined in the
// javadoc comments.
return 0;
}
/**
* Returns a new array containing the even ints from a given array in the same
* order they appear in the given array.
*
* @param a an array of ints
* @return a new array containing the even ints from {@code a} input array in
* the same order they appear in the array
*/
public static int[] getEvens(int[] a){
// TODO
// Modify the body of this method so that it behaves as outlined in the
// javadoc comments.
int[] answer = new int[0];
return answer;
}
}

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 Accounting Questions!