Question: Program 2: Strings Analysis ID: ID002 Make sure you include this ID as a System.out.println() message at the beginning of your program. This helps us

Program 2: Strings Analysis

ID: ID002

Make sure you include this ID as a System.out.println() message at the beginning of your program. This helps us with grading, and is required.

Description: Write a program with the class name Strings Analysis. Allow the user to enter a String of any length. Next, the user will then enter a letter. Next, the user will then enter a index number. Your program will test the following:

What is the String length?

What is the index of the letter?

What letter is at the index number?

Make sure that your program can handle indexes that are larger than the String, and letters that do not exist. Print Not Valid for slot numbers or letters that are not in the String.

Below is the input and the output we expect from your program. This is to help you know if you are on the right track. To test this Post Lab we might enter many Strings and letters and numbers.

Example input :

Hi this is a String that is being inputted

t

8

Example output:

ID002

Please enter a String: [String]

Enter a letter: [String, but turned into a char]

Enter a slot number: [integer]

The String length is: 42

The slot number of letter t is: 3

The the letter at slot 8 is: i

Example input :

Hi

t

8

Example output:

ID002

Please enter a String: [String]

Enter a letter: [String, but turned into a char]

Enter a slot number: [integer]

The String length is: 2

The slot number of letter t is: Not Valid

The the letter at slot 8 is: Not Valid

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!