Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that prompts a user, using Scanner, for 2 secret messages. Each message has its own set of rules you need to use
Write a program that prompts a user, using Scanner, for 2 secret messages. Each message has its own set of rules you need to use to decode it. You will use String methods to change the messages you receive from the user.
*Note: Ensure that you make the changes in the order they are specified and do the operations on the updated String
Sentence 1:
- Make everything after the first word lowercase
- Remove the last space
- Remove the first 3 characters
- Change every z to an m
- Change every w to a space
- Find the first a and change it to a g
Sentence 2:
- Trim the extra white space from the sentence
- Replace every instance of asdf with the second character in the sentence
Take the first 8 characters and put them at the end of the sentence
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