Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help needed in java ! data1.txt Java is great. 8 12 wonderful data2.txt I love you. 2 5 hate data3.txt Welcome to the University of
Help needed in java !
data1.txt
Java is great. 8 12 wonderful
data2.txt
I love you. 2 5 hate
data3.txt
Welcome to the University of Cincinatti. 29 38 Dayton
Write a program that reads in a line of text (string), two indexes (two ints index, and indexa) and a word (String) from a text file, and then outputs that line of text with the substring between indexi and indexa changed to word. For example, a possible sample dialogue might be the following (user input in color) File name: data2. tx Line of text read from file: I love you. starting index: 2 Ending index: 5 Word to look for love Replacement word: hate I have rephrased that line to read: I hate you You can assume that word, occurs in the input text. If word, occurs more than once in the line, your program should replace only the first occurrence of word The program should work for each of the following text files data1.t data2.txt . data3.xt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started