Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use Java You can assume that the String will be valid. The unformatted string is always in the following format: Hello, my name is
Please use Java
You can assume that the String will be valid. The unformatted string is always in the following format: Hello, my name is NAME. I need to report EVENT. Please come to WHERE. - NAME: This part is the caller's name. - EVENT: This part describes the event called in. It may be one word (e.g. "theft"), or more than one word (e.g. "heart attack", "a very serious collision"). You should handle both lowercase and uppercase letters in the event. street (with possible spaces in between for the street name). An example of this is "127 East Main Street". As mentioned above, your method should take the unformatted string and format it in a specific way like described below. The all-capitalized parts are the parts you need to move around to match the following format: EVENT at WHERE reported by NAME Note: Please follow the format and do not include excessive elements or spaces. Examples System.out.println(emergency("Hello, my name is John Smith. I need to report a fire. Please come to 100 Circle Road.")); // expecting "a fire at 100 Circle Road reported by John Smith" System.out.println(emergency("Hello, my name is Mary Smith. I need to report a car accident. Please come to 2635 Main Street.")); // expecting "a car accident at 2635 Main Street reported by Mary Smith" System.out.println(emergency("Hello, my name is Joe Bell. I need to report a robbery. Please come to 3595 Oakwood Avenue.")); // expecting "a robbery at 3595 Oakwood Avenue reported by Joe M BellStep 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