Computers and Technology
Computers and Technology, 08.02.2021 19:10, kileylynn

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!

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 12:20, crodriguez87
Usually, when we sniff packets, we are only interested certain types of packets. we can do that by setting filters in sniffing. scapy’s filter use the bpf (berkeley packet filter) syntax; you can find the bpf manual from the internet. set the following filters and demonstrate your sniffer program again (each filter should be set separately): (a) capture only the icmp packet. (b) capture any tcp packet that comes from a particular ip and with a destination port number 23. (c) capture packets comes from or to go to a particular subnet. you can pick any subnet, such as 128.230.0.0/16; you should not pick the subnet that your vm is attached to.
Answers: 3
image
Computers and Technology, 22.06.2019 21:30, elsauceomotho
Im doing this last minute and literally none of my neighbors or people that my dad works with use excel so if anyone could me make up an example
Answers: 1
image
Computers and Technology, 23.06.2019 00:00, puppylove899
Which is the correct sequence of steps to set up a document in landscape orientation? a. select page setup from the file menu. then click the margins tab and select landscape. b. select page setup from the edit menu. then click the margins tab and select landscape. c. select page setup from the insert menu. then click the margins tab and select landscape. d. select page setup from the format menu. then click the margins tab and select landscape
Answers: 1
image
Computers and Technology, 23.06.2019 01:50, jumoke26
Create a class named majors that includes an enumeration for the six majors offered by a college as follows: acc, chem, cis, eng, his, phys. display the enumeration values for the user, then prompt the user to enter a major. display the college division in which the major falls. acc and cis are in the business division, chem and phys are in the science division, and eng and his are in the humanities division. save the file as majors. java.
Answers: 2
Do you know the correct 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: