Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!