Question: Problem 1a: Create a method called toCamelCase that accepts a string as an input and outputs that string in camelCase. (i.e. no spaces and all

 Problem 1a: Create a method called toCamelCase that accepts a string

Problem 1a: Create a method called toCamelCase that accepts a string as an input and outputs that string in camelCase. (i.e. no spaces and all words capitalized except the first. thisIsACamelCasedSentence) This must be achieved recursively. The method does not have to handle punctuation, but must be able to handle any number of spaces between words, or at the beginning and/or end of the input string. Example input: pErHaPs I hAVe wRitten a Sentence LiKE this one Output: perhapsIHaveWrittenASentenceLikeThisOne

Problem 1b: Youre on a treasure hunt through a series of caves deep in the jungle. You are equipped with a certain number of flashlights, capable of finding specific treasures depending on the flashlights integer value. PLEASE SEE EXAMPLE BELOW FOR STRUCTURE AND HELP How this works: 1.Create a random series of caves (integer array). There must be between 1 and 10 caves. 2.Fill each cave with a treasure (an integer between 1 and 9). 3.Randomly decide how many flashlights to take(integer array). You will take between 1 and 4 flashlights. 4.Randomly choose which flashlights to take. Flashlights will be represented by an integer value between 1 and 1,000,000. Can this flashlight find that treasure?: A caves treasure, represented by an integer value between 1 and 9 can only be discovered by a flashlight whose values recursive sum of its digits make up the caves value. Example: Flashlight value = 1174 so 1+1+7+4 = 13 and 1+3 = 4. Therefore, any cave with a value of 4 can have its treasure found by this flashlight Create two methods, treasureHunt and searchCave. These methods will work together, treasureHunt will call searchCave. treasureHunt will be written iteratively and searchCave will be written recursively.

Main java X eimport java.util.Arrays; 2 import java.util.Random; 4 public class Main public static void main(String[1 args) t String testStr" this System.out.println("input: " + testStr); System.out.print Ln(" output: " toCamelCase(testStr)); SENTENCE SHOULD be reTuRned in LOWER CaMeL Case Random rand new Random); int hoManyCaves rand. nextInt (9) 1; int howManyFlashLights- rand.nextInt (3) + 1; int [] caves new int [howManyCaves] int[] flashLights= new int [ho Many FlashL ights]; 10 16 17 for(int i-0; i

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!