Question

Transcribed Image Text:Write a program named Lab18D with:
• A recursive method that accepts an array of strings. It should return a count of
strings in the array that start with an 's' and print them as well (on one line
with a space between them).
A second recursive void method that receives an array of strings and prints
the array (on one line with spaces between the values.) Don't use the
Arrays.toString method to shortcut this; each recursive call of the method
should only print one string.
The main method should read an unknown number of strings from the input
file (Lab18D.txt) into an array. (Each string is a single word.)
Call the method to print the array and then the method to look for strings
starting with an 's'. Print a label before calling this method.

Transcribed Image Text:hello
hi
fruitcake
sunshine
yellow
purple
red
green
blue
butterfly
bird
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images

Knowledge Booster
Similar questions
- Write a static recursive method in Java called mRecursion that displays all of the permutations of the charactersin a string passed to the method as its argument. For example, the character sequence abc has thefollowing permutations: acb, bac, bca, cab, cba. Then Write a static method called getInput that get aninput string from the user and passed it to the mRecursion method written above in a method call.Please does so using what I already had //Get input from in to call recursive method //to display those char permutations public static String getInput ( ) { Scanner in = new Scanner(System.in); String combination = in.nextLine(); System.out.println("Enter string:); return stringComb; //Method to show permutations of a desired string// This only return 3 string combination for some reason static void myRecursion(String aString) { //isEmpty check if ( aString.length() == 0){…arrow_forwardPlease help me with the below using java. Please also comment the code (explai. What each li e is doing). Please make sure both codes are completed using recursionarrow_forwardGiven a list of integers, you want to know whether it is possible to divide the integers into two sets, so that the sums of the two sets are the same. Every integer must be in one set or the other. Write a recursive helper method that takes any number of arguments you like, and make the initial call to your recursive helper method from equalSum(). Do not use any loops or regular expressions. Test case 1: equalSum([2, 3, 5]) true Test case 2: equalSum([2, 2, 5]) falsearrow_forward
- Please complete the task by yourself only in JAVA with explanation. Don't copy. Thank you. Using quicksort to sort an array of car objects by various criteria. Define a class Car as follows: class Car { public String make; public String model; public int mpg; // Miles per gallon } b) Implement a comparator called CompareCarsByDescendingMPG that can be passed as an argument to the quicksort method from the lecture notes. CompareCarsByDescendingMPG should return a value that will cause quicksort to sort an array of cars in descending order (from largest to smallest) by mpg.arrow_forwardWrite a recursive method oddSum that takes a positive odd integer n and returns the sum of odd integers from 1 to n.arrow_forwardjavaarrow_forward
arrow_back_ios
arrow_forward_ios