Write the method boolean areAllEven(int[] nums) in Java that returns true if all elements in the array nums are even numbers, and returns...
Search Results
Searching for: if
Individual Exercises
Write the method boolean areAllOdd(int[] nums) in Java that returns true if all elements in the array nums are odd numbers, and returns...
Write the method boolean areAllGreaterThan(int[] nums, int x) in Java that returns true if all elements in the array nums are greater...
Write the method boolean areAllLessThan(int[] nums, int x) in Java that returns true if all elements in the array nums are less than the...
Write the method int sumAllPositives(int[] nums) in Java that returns the sum of all elements in the array nums that are positive.
Write the method int sumBeforeNegative(int[] nums) in Java that returns the sum of the elements in the array nums up till the first...
Write the method int sumAfterNegative(int[] nums) in Java that returns the sum of the elements in the array nums after the first negative...
Write the method String convertName(String name) in Java that implements the following logic: Given a string in the form of "last_name,...
Write the method String convertDate(String name) in Java that implements the following logic: Given a data in string format in the form...
Write the method String convertTime(String time) in Java that implements the following logic: Given a time in 24hr format, often refered...
Write the method String convertPhone(String number) in Java that implements the following logic: Given a phone number as a string of...
Write the method boolean hasPrefix(String word) in Java that returns true if the string in word begins with one of these prefixes:
"pre",...
Write the method boolean hasSuffix(String word) in Java that returns true if the string in word ends with one of these suffixes:
"er",...
Write the method boolean containsRoot(String word) in Java that returns true if the string in word contains inside (see below) one of...
Given an integer array length of 1 or more, return the difference between the largest and smallest values in the array. Note that the...
Return an array that is "left shifted" by one--so for an input of {6, 2, 5, 3}, the method returns {2, 5, 3, 6}. You may modify and...
Given a binary tree, write a recursive function to return the difference between the sum of all node values at odd levels and sum of all...
A local grocery store has asked you to design a method to verify if their produce is okay to put on the shelves. The method takes an...
This method takes an integer array as a parameter and returns the minimum difference between adjacent values in the array. The difference...
Rewrite the function getElementAt() so that it returns the element nth in the array numbers, but only if there is an element at that...
Given three variables called first, second and third. If third is less than the difference of first and second, then return third....
Given an integer month_number, complete the function using a switch statement so that the string month_name is assigned the name of the...
Write a function in Java that calculates the difference between the volumes of two cubes. Given two doubles: sideLength1 and sideLength2...