Question: Write a program that accepts a paragraph of text that can be manipulated. The resulting manipulated text will output to the console. Constraints The user

Write a program that accepts a paragraph of text that can be manipulated. The resulting manipulated text will output to the console.

Constraints

The user should input a paragraph of text such as a famous quote

The program repeats the paragraph before displaying the following menu of options:

Please choose from the following menu of options:

1. Convert to all uppercase letters

2. Convert to all lowercase letters

3. Display the length of the paragraph

4. Select a substring from the paragraph

5. Let Random select a substring from the paragraph

6. Exit

Requirements

All printed results should use formatted output (Do not use + in your output statements)

Use a switch/case block of code that will act on each menu option

Use line break escape sequences with your formatting escape sequence to format your output as shown in the examples below

For menu option 4, the questions should also use formatted output and the upper limit should use the .length() method in the first question

Use the Math.random() method and formatted output for menu option 5

This program will utilize code learned from Week 1 through Week 4

Hints

For menu option 5, you might want to consider finding the second random limit before finding the first. The second limit (the end limit) may come in handy for your lower limit formatted output line. Think length when finding the upper limit

Use System.exit(0); to properly exit the program if a choice or default option fires

Expected Output

Below you will find sample output for each menu option. User input is in BOLD.

Sample Output

Menu Option 1:

Please enter a paragraph of text

: Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

You entered:

Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

Please choose from the following menu of options:

1. Convert to all uppercase letters

2. Convert to all lowercase letters

3. Display the length of the paragraph

4. Select a substring from the paragraph

5. Let Random select a substring from the paragraph

6. Exit

: 1

Your paragraph in all uppercase letters

: FOUR SCORE AND SEVEN YEARS AGO OUR FATHERS BROUGHT FORTH ON THIS CONTINENT, A NEW NATION, CONCEIVED IN LIBERTY, AND DEDICATED TO THE PROPOSITION THAT ALL MEN ARE CREATED EQUAL.

Menu Option 2:

Please enter a paragraph of text

: Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

You entered

: Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

Please choose from the following menu of options:

1. Convert to all uppercase letters

2. Convert to all lowercase letters

3. Display the length of the paragraph

4. Select a substring from the paragraph

5. Let Random select a substring from the paragraph

6. Exit

: 2

Your paragraph in all lowercase letters:

four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal.

Menu Option 3:

Please enter a paragraph of text

: Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

You entered:

Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

Please choose from the following menu of options:

1. Convert to all uppercase letters

2. Convert to all lowercase letters

3. Display the length of the paragraph

4. Select a substring from the paragraph

5. Let Random select a substring from the paragraph

6. Exit

: 3

The length of your paragraph is: 176 characters & spaces.

Menu Option 4:

Please enter a paragraph of text

: Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

You entered:

Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

Please choose from the following menu of options:

1. Convert to all uppercase letters

2. Convert to all lowercase letters

3. Display the length of the paragraph

4. Select a substring from the paragraph

5. Let Random select a substring from the paragraph

6. Exit

: 4

Select a starting point between 0 and 176: 39

Select a starting point between 39 and 176: 141

The substring you selected is:

ers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposit

Menu Option 5:

Please enter a paragraph of text

:Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

You entered:

Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

Please choose from the following menu of options:

1. Convert to all uppercase letters

2. Convert to all lowercase letters

3. Display the length of the paragraph

4. Select a substring from the paragraph

5. Let Random select a substring from the paragraph

6. Exit

: 5

Random selected a starting point of: 9

And an ending point of: 113

Your Random substring is:

e and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, a

Menu Option 6:

Please enter a paragraph of text

: Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

You entered:

Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

Please choose from the following menu of options:

1. Convert to all uppercase letters

2. Convert to all lowercase letters

3. Display the length of the paragraph

4. Select a substring from the paragraph

5. Let Random select a substring from the paragraph

6. Exit

: 6

Thank you for using the program. Goodbye

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!