Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following program takes a phrase (e.g. Intersectional Social Justice) and converts it into an array ([Intersectional, Social, Justice]). Your task is to create a
The following program takes a phrase (e.g. Intersectional Social Justice) and converts it into an array (["Intersectional", "Social", "Justice"]). Your task is to create a new string with the acronym of the phrase (e.g. ISJ) and print out this new string. Your acronym program should work for strings of any length where words are separated by a single space with no spaces before or after the phrase. The solution to this problem is a combination of the solution to the two Array problems we covered in WK1 lecture. import java.util.Arrays; import java.util.Scanner; public class WK1 { public static void main(String[] args) { //use the Scanner class to read input from the keyboard Scanner in = new Scanner(System.in); //users must enter a string separated with spaces //example: user enters "intersectional social justice" System.out.println("Enter a phrase: "); String input = in.nextLine(); //the split method of the String class splits a string //at a specified character and saves them in an array //example: //phrase -> ["intersectional", "social", "justice"] String[] phrase = input.split(" "); System.out.println (Arrays.toString (phrase)); ///////Your code goes here/////// }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started