subject

Your goal is to write a JAVA program that will ask the user for a long string and then a substring of that long string. The program then will report information on the long string and the substring. Finally it will prompt the user for a replacement string and show what the long string would be with the substring replaced by the replacement string. Each of the lines below can be produced by using one or more String methods - look to the String method slides on the course website to help you with this project. A few sample transcripts of your code at work are below - remember that your code should end with a newline as in the textbook examples and should produce these transcripts exactly if given the same input. Portions in bold indicate where the user has input a value.
One run of your program might look like this:
Enter a long string: The quick brown fox jumped over the lazy dog
Enter a substring: jumped
Length of your string: 44
Length of your substring: 6
Starting position of your substring: 20
String before your substring: The quick brown fox
String after your substring: over the lazy dog
Enter a position between 0 and 43: 18
The character at position 18 is x
Enter a replacement string: leaped
Your new string is: The quick brown fox leaped over the lazy dog
Goodbye!
A second run with different user input might look like this:
Enter a long string: Friends, Romans, countrymen, lend me your ears
Enter a substring: try
Length of your string: 46
Length of your substring: 3
Starting position of your substring: 21
String before your substring: Friends, Romans, coun
String after your substring: men, lend me your ears
Enter a position between 0 and 45: 21
The character at position 21 is t
Enter a replacement string: catch
Your new string is: Friends, Romans, councatchmen, lend me your ears
Goodbye!

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, smariedegray
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
image
Computers and Technology, 23.06.2019 02:30, reyne36
Rafael needs to add a title row to a table that he has inserted in word. what should he do? use the alignment options. use the merge and center option for all the cells in the top row. use the merge and center option on the first two cells in the top row. none of the above
Answers: 3
image
Computers and Technology, 23.06.2019 07:00, schvox
1. you have a small business that is divided into 3 departments: accounting, sales, and administration. these departments have the following number of devices (computers, printers, etc.): accounting-31, sales-28, and administration-13. using a class c private network, subnet the network so that each department will have their own subnet. you must show/explain how you arrived at your conclusion and also show the following: all available device addresses for each department, the broadcast address for each department, and the network address for each department. also, determine how many "wasted" (not usable) addresses resulted from your subnetting (enumerate them).
Answers: 3
image
Computers and Technology, 23.06.2019 15:00, Siris420
Plz ( which is an example of a good url?
Answers: 1
You know the right answer?
Your goal is to write a JAVA program that will ask the user for a long string and then a substring o...

Questions in other subjects: