Answered step by step
Verified Expert Solution
Question
1 Approved Answer
When i chose a it prints out input a new main sentence and the new main sentence is at the same time. It doesnt allow
When i chose "a" it prints out "input a new main sentence" and "the new main sentence is" at the same time. It doesnt allow the user to enter the string. I can't seem to fix or find the error.
Enter a new main sentence: Ask the user to input a new sentence. This sentence will be later on used in the other menu operations
StringsJava TeamProgramming Java Problems @ J vadoc e, Declarationconsole ibraryyJava k-9.0.1 8 import java.util.Scanner; 9 public class Strings 10 11 public static void main String] args) 13 14 16 17 A. Enter a new main sentence B. Find a String C. Find all incidents of a String D. Find and Replace a String E. Replace all the incidents of a String F. Count the nunber of words G. Count a letter's accurences H. Count the total number of letters I. Delete all the occurences of a word Exit Scanner input ne Scanner(System.in); System.out.printCn A. Enter a new rain sentence. B. Find a String. n C. Find all incidents ofa System.out.print 'nEnter your choice: ) String choice input.nextO 19 ifCchoice.equals"a)) 21 23 System.out.print("mInput a nen Main Sentence: ); String s- input.nextlineOi System.out.printLn(nThe new Main Sentence is: "s); Enter your choice: o Input a new Main Sentence The no Hain Sentence is: 25 27 29 30Step 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