Alter your program such that it will identify a target String within another String. Prompt the user for a String. Then prompt the user for a target String. Your program should find each occurrence of that target string in the other String. If the target string is not contained in the other string indicate that to the user. For each occurrence of the target string contained in the other String, display the starting index of the target string, the ending index of the target string, the ASCII character preceding the target string, the ASCII character following the target string. You must find strings that differ only in case. Place this code inside a do-while loop and allow the user to repeat it as many times as they would like.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%
  • Alter your program such that it will identify a target String within another String. Prompt the user for a String. Then prompt the user for a target String. Your program should find each occurrence of that target string in the other String. If the target string is not contained in the other string indicate that to the user. For each occurrence of the target string contained in the other String, display the starting index of the target string, the ending index of the target string, the ASCII character preceding the target string, the ASCII character following the target string. You must find strings that differ only in case.
  • Place this code inside a do-while loop and allow the user to repeat it as many times as they would like.
  • submit your program as an Eclipse .zip project

Example of what the program might look like running.

This program identifies if a target String is contained within anoteher String.
And, if it is there it returns the first occurence of that String.
It also identifies the character before the found String and the character after the found String.
Please enter a target String:is
Please enter the String to be searched:This iss a test of the issue of finding is
The target "is" is found at index 2 in "This iss a test of the issue of finding is"
The character "h" is in front of it'
The character " " is following it.
We will now check for multiple instances of the target
The target "is" is found at index 2 in "This iss a test of the issue of finding is"
The character "h" is in front of it'
The character " " is following it.
The target "is" is found at index 5 in "This iss a test of the issue of finding is"
The character " " is in front of it'
The character "s" is following it.
The target "is" is found at index 23 in "This iss a test of the issue of finding is"
The character " " is in front of it'
The character "s" is following it.
The target "is" is found at index 40 in "This iss a test of the issue of finding is"
The character " " is in front of it'
There is no character following it
Would you like to repeat this program?
Please enter "y" for yes or "n" for no.
yes
Please enter "y" for yes or "n" for no.
y
This program identifies if a target String is contained within another String.
And, if it is there it returns the first occurrence of that String.
It also identifies the character before the found String and the character after the found String.
Please enter a target String:his
Please enter the String to be searched:Hers isnt the one
The target "his" is not found in "Hers isnt the one"
We will now check for multiple instances of the target
The target "his" is not found in "Hers isnt the one"
Would you like to repeat this program?
Please enter "y" for yes or "n" for no.

Please enter "y" for yes or "n" for no.
n

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY