Some lines in the file have a line number, as shown in the following figure. A line number is the first word in the line. A line number is delimited by one or more whitespace characters. A line number may also be preceded with one or more whitespace characters. Write a program that prompts the user to enter a file name, reads the lines from the file, and replaces the line numbers in the file with appropriate numbers of spaces. For example, you need to replace the line number 2 with one space and line number 34 with two spaces, and you should keep the two spaces preceding line number 34. Name your class file as RemoveLineNumber.java. You do not need to submit the .txt file that you use to test your program.
Some lines in the file have a line number, as shown in the following figure. A line number is the first word in the line. A line number is delimited by one or more whitespace characters. A line number may also be preceded with one or more whitespace characters. Write a program that prompts the user to enter a file name, reads the lines from the file, and replaces the line numbers in the file with appropriate numbers of spaces. For example, you need to replace the line number 2 with one space and line number 34 with two spaces, and you should keep the two spaces preceding line number 34. Name your class file as RemoveLineNumber.java. You do not need to submit the .txt file that you use to test your program.
Chapter13: File Input And Output
Section: Chapter Questions
Problem 6PE
Related questions
Question
this is a java program code please do the code what in the question says and please follow what in the question says and dont copy or plagarise from other sources
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 5 steps with 7 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr