Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code using Java. Abide by instructions and achieve correct expected output. ChangedMe.txt This is a short flat file. The lines or records in the file
Code using Java. Abide by instructions and achieve correct expected output.
ChangedMe.txt This is a short "flat" file. The lines or records in the file will be of varying lengths and not all of them will be full sentences. Some lines will be very short; some of the lines or "records" will be much longer. In processing this file, you will need to be SURE TO MAINTAIN ITS STRUCTURE. That is, you may not change the length of any line. Nor may change where a line or record ends or begins; you must also maintain the punctuation as provided. There are no blank lines in the file - there should be no blank lines in your updated version. A byte-by-byte comparison will be made between the modified file you submit and the expected results. In order to earn a perfect score, your updated file must EXACTLY match the expected results. Doing some desk-checking here would be highly advisable. You MAY NOT USE AN ARRAY or any other structure for storing the input lines prior to modification. The LOOP you write to process the input file must READ from the INPUT file and then directly WRITE to the OUTPUT file. No intermediate processing or storage should take place.
ChangedYou.txt
Th1s 1s @ short "fl@t" f1l3. Th3 l1n3s or r3cords 1n th3 f1l3 w1ll b3 of v@ry1ng l3ngths @nd not @ll of th3m w1ll b3 full s3nt3nc3s. Som3 l1n3s w1ll b3 v3ry short; som3 of th3 l1n3s or "r3cords" w1ll b3 much long3r. In proc3ss1ng th1s f1l3, you w1ll n33d to b3 SURE TO MAINTAIN ITS STRUCTURE. Th@t 1s, you m@y not ch@ng3 th3 l3ngth of @ny l1n3. Nor m@y ch@ng3 wh3r3 @ l1n3 or r3cord 3nds or b3g1ns; you must @lso m@1nt@1n th3 punctu@t1on @s prov1d3d. Th3r3 @r3 no bl@nk l1n3s 1n th3 f1l3 - th3r3 should b3 no bl@nk l1n3s 1n your upd@t3d v3rs1on. A byt3-by-byt3 comp@r1son w1ll b3 m@d3 b3tw33n th3 mod1f13d f1l3 you subm1t @nd th3 3xp3ct3d r3sults. In ord3r to 3@rn @ p3rf3ct scor3, your upd@t3d f1l3 must EXACTLY m@tch th3 3xp3ct3d r3sults. Do1ng som3 d3sk-ch3ck1ng h3r3 would b3 h1ghly @dv1s@bl3. You MAY NOT USE AN ARRAY or @ny oth3r structur3 for stor1ng th3 1nput l1n3s pr1or to mod1f1c@t1on. Th3 LOOP you wr1t3 to proc3ss th3 1nput f1l3 must READ from th3 INPUT f1l3 @nd th3n d1r3ctly WRITE to th3 OUTPUT f1l3. No 1nt3rm3d1@t3 proc3ss1ng or stor@g3 should t@k3 pl@c3.Description This lab will require you to read in (via Scanner object) a flat' or clear text file, one line at a time. You will update each line of the file per provided specifications. You will then write each modified line to c new output text file (via Formatter object). Provided Resources You have been provided with the following: Lab 08 Instructions The input file (changeMe.txt) Expected Results (changedYou.txt) NOTE: No starting point is provided for this lab. * Requirements You will probably want to refer to your text, Chapter 15, section 15.4 for examples and explanations. Name your code Labe8.java. You will need to consider the following points: * Necessary import statements o File handling o Exception handling Contents (and order, as needed) of try block(s) Contents of catch block(s) * Structure and control of the loop you will use to control the process Specific Processing Requirements 1. Name the output file: changedYou.txt 2. For each individual line in the input file, make the following modifications: a. Replace each character ""e" with a "3" b. Replace each character"" with an "@, c. Replace each character "i" with "1" 3. 4. 5. Write each modified line to the output file Close input and output files when you are finished with them You MAY NOT use an array or any other means of storing multiple lines of text during processing
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