Write a one-class program called Lines that takes a single file name as a command line...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a one-class program called Lines that takes a single file name as a command line argument and creates a new file, output.txt that is a copy of the specified file except that each line is preceded by line numbers. For example if the input file is called happy.txt and contains: Happy happy! Joy joy! It's the happy happy joy joy song! Then output.txt should contain: /*1*/ Happy happy! /* 2*/ Joy joy! /*3*/ It's the happy happy /* 4 */ joy joy /* 5 */ song! Make sure your program does not print anything. It must take one and only one command line argument. That argument should be the name of the input file. It should then create a new file called (output. txt that should be a line-numbered version of the original. In the above example, running the file should look like this: java Lines happy.txt This should write a new file called output.txt with the added line numbers as described above. Please use the template for Lines.java provided on Codio. Write a one-class program called Lines that takes a single file name as a command line argument and creates a new file, output.txt that is a copy of the specified file except that each line is preceded by line numbers. For example if the input file is called happy.txt and contains: Happy happy! Joy joy! It's the happy happy joy joy song! Then output.txt should contain: /*1*/ Happy happy! /* 2*/ Joy joy! /*3*/ It's the happy happy /* 4 */ joy joy /* 5 */ song! Make sure your program does not print anything. It must take one and only one command line argument. That argument should be the name of the input file. It should then create a new file called (output. txt that should be a line-numbered version of the original. In the above example, running the file should look like this: java Lines happy.txt This should write a new file called output.txt with the added line numbers as described above. Please use the template for Lines.java provided on Codio.
Expert Answer:
Answer rating: 100% (QA)
import javaio Buffered Reader import javaioBuffered Writer import javaioFi... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
THIRD AVENUE SOFTWARE HEALTH-CARE APP PROJECT This case is new for the ninth edition of Information Technology Project Management . The case provides an opportunity to apply agile and Scrum...
-
A machine fills containers with a particular product. The standard deviation of filling weights computed from past data is 0.6 ounces. If only 2% of the containers hold less than 18 ounces, what is...
-
On September 30, 2011, Print-O-Matic Inc. entered into an arrangement with its bank to borrow $250,000. The principal is due on October 1, 2016, and the note has a stated annual interest rate of 10...
-
What ethical dilemmas are involved with choosing not to conduct background checks?
-
In 2013, Thomas DePrince, a passenger aboard a cruise ship, visited the ships jewelry boutique, operated by Starboard Cruise Services, Inc. DePrince told the employees of the boutique that he was...
-
Fall-Line, Inc. is a Great Falls, Montana, manufacturer of a variety of downhill skis. Fall-line is considering four locations for a new plant: As Pen Colorado; Medicine Lodge Kansas; Broken Bow,...
-
From the following ER diagram a) Translate it into a relational model b) Normalize it into BCNF (if possible) user id email name item_id description AuctionStartDate password phone_no age Browses 1...
-
On December 1, Year 1, John and Patty Driver formed a corporation called Susquehanna Equipment Rentals. The new corporation was able to begin operations immediately by purchasing the assets and...
-
In the diffraction experiment, if the distance between slit and screen Equals Ten thousand times the distance between the central fringe to the first fringe. Then find the wavelength of the laser...
-
Melbourne, VIC . The auction property has been passed in and you are negotiating between vendor and the highest bidder but they remain apart with your vendor reluctant to reduce from their reserve,...
-
2016 ACC Expert Consensus Decision Pathway on the Role of Non-Statin Therapies and the 2017 focused update of the 2016 ACC Expert Consensus Decision Pathway on the Role of Non-Statin Therapies for...
-
SCENARIO To the person in charge at Cartier: I am writing to you because of back to back bad experiences with Cartier recently and I feel compelled to share my feedback as this is not the level of...
-
Course: Professional Selling / Business Please Don't Copy/Paste. Answer the following questions- Q1. Background: You've had success at Stanley Black & Decker in your initial role as an Inside Sales...
-
13. Cash Flow Identity The Stancil Corporation provided the following information: Proceeds from long-term borrowing $19,800 Proceeds from the sale of common stock 3,240 Purchases of fixed assets...
-
Let the graph of y = f(a) (solid) and y = g(x) (dashed) be shown below. TA " 1 " T f n Q(-2) = 21 1 Suppose Q(x) Q'(-2) = 1 V = T 10-9-8-7-6-5-4-3-2 1 la V g(x) A 998 6 7 65 9 5 44,2 3 1 123 -3 4567...
-
What is taxable income, and what is the formula for determining taxable income?
-
Ulysses and Penelope are married and file separate returns for 2012. Penelope itemizes her deductions on her return. Ulysses' adjusted gross income was $17,400, his itemized deductions were $2,250,...
-
Harold Conners (Social Security number 785-23-9873) lives at 13234 DeMilo Drive, Houston, TX 77052, and is self-employed for 2012. He estimates his required annual estimated tax payment for 2012 to...
-
Abigail (Abby) Boxer is a single mother working as a civilian accountant for the U.S. Army. Her Social Security number is 676-73-3311 and she lives at 3456 Alamo Way, San Antonio, TX 78249. Helen,...
-
A cylinder of mass \(M\), moment of inertia \(I\) about the cylindrical axis and radius \(R\) rolls on a horizontal surface without slipping. (a) Express the no-slip constraint in differential form....
-
A block of mass \(m\) slides without friction on a larger block of mass \(M\) and is attached to a pin in this block by a massless spring with spring constant \(k\). All motion is in one dimension....
-
A bead of mass \(m\) is threaded without friction on a massless wire hoop of radius \(R\) that is forced to oscillate vertically in a fixed vertical plane at angular frequency \(\omega\) and with...
Preparing For The 2019 California Mft Law And Ethics Exam 1st Edition - ISBN: 0998928550 - Free Book
Study smarter with the SolutionInn App