Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

What are possible safety concerns? Explain.

Answered: 1 week ago

Question

What would you do if you were in Margarets shoes?

Answered: 1 week ago