The 10 Write a Class called Censor. It should have a static method censor (File source,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The 10 Write a Class called Censor. It should have a static method censor (File source, File destination, File badlist) that reads each line in badlist and then replaces any occurrence of a word (or words) specified on a line in badlist in the source file, putting the new text in the destination file. The replacement should consist of the same number of characters as the replaced text length. If should not match across linebreaks. You can (and should) use anything in the String class, anything related to regular expressions and your preferred File 10 from the java.10 package. You should code everything else on your own. Your submission should include an appropriate text chosen by you, no longer than 20k, an amusing badlist file and the resulting output in a third file. You should have a main method that uses the first two files to generate the third. Example: with badlist "foo", "bar" and input "The prof uses foo and bar too often in class. It is like being in a barn." would be output "The prof uses ***and*** too often in class. It is like being in a The 10 Write a Class called Censor. It should have a static method censor (File source, File destination, File badlist) that reads each line in badlist and then replaces any occurrence of a word (or words) specified on a line in badlist in the source file, putting the new text in the destination file. The replacement should consist of the same number of characters as the replaced text length. If should not match across linebreaks. You can (and should) use anything in the String class, anything related to regular expressions and your preferred File 10 from the java.10 package. You should code everything else on your own. Your submission should include an appropriate text chosen by you, no longer than 20k, an amusing badlist file and the resulting output in a third file. You should have a main method that uses the first two files to generate the third. Example: with badlist "foo", "bar" and input "The prof uses foo and bar too often in class. It is like being in a barn." would be output "The prof uses ***and*** too often in class. It is like being in a
Expert Answer:
Answer rating: 100% (QA)
import javautil import javaio public class Censor public static void censorFile source File destination File badlist throws IOException read each line ... View the full answer
Related Book For
Accounting Principles
ISBN: 978-0470534793
10th Edition
Authors: Jerry J. Weygandt, Paul D. Kimmel, Donald E. Kieso
Posted Date:
Students also viewed these computer network questions
-
The following is taken from the Sinjh Corporation balance sheet. SINJH CORPORATION Balance Sheet (partial) December 31, 2015 Current liabilities Interest payable (for 12 months from January 1 to...
-
A pair of points is given. (0, 8), (3, 0) (b) Find the distance between them. (c) Find the midpoint of the segment that joins them. (x, y) = ------- Find an equation of the circle that satisfies the...
-
The following is an alphabetical listing of Stone Boat Companys balance sheet accounts and account balances on December 31, 2016: Additional information : 1. The company reports on the balance sheet...
-
If a large chilled water plant has 6 chillers and 5 of them are operating at 1 0 0 % , when the operator starts the 6 th chiller, to what percent do the first 5 chillers unload? What formula do you...
-
The following passage is taken from a marketing research report prepared for a group of printers and lithographers without much formal education who run a small family-owned business: To measure the...
-
Consider a discrete memory less source whose alphabet consists of K equiprobable symbols. (a) Explain why the use of a fixed-length code for the representation of such a source is about as efficient...
-
Identify the audit procedures in tests of receivable balances that satisfy the audit objectives of (a) existence and occurrence and (b) completeness.
-
Reducir, Inc., produces two different types of hydraulic cylinders. Reducir produces a major subassembly for the cylinders in the cutting and welding department. Other parts and the subassembly are...
-
Bonika Sdn Bhd ( BSB ) ?manufactures small camping tents. BSB produced 3 , 0 0 0 ?units during theyear. These camping tents sell for RM 1 5 0 ?each. BSB had 5 0 0 ?units in finished goodsinventory at...
-
What Happens When You Dont Deliver on Your Promises Web: www.clearly.ca Facebook: Clearly Canadian If a new product or service seems like the perfect option to solve a problem or capitalize on an...
-
Summer thunderstorms in the southern U.S. are usually produced by towering ________ clouds that form by ________. nimbostratus; frontal uplift cumulonimbus; frontal uplift nimbostratus; convection...
-
Read the Canadian HR Reporter articleCost savings, staffing advantages to 'distributed workplaces'and answer the following question in the space provided: 1. In your opinion, what are the advantages...
-
How can firms seek to form a culture that protects employees from sexual harassment? 2. What should firms do when victims allege retaliation for reporting sexual harassment
-
Explain the different types of loss on the spectrum including: primary loss secondary loss cumulative loss integration of loss
-
Suggest a way of telling an employee about his/her bad breath.?
-
What companies do Coca-Cola describe as significant equity method investments? How do these investments help Coca-Cola? What criteria does Coca-Cola use in choosing to apply the equity method for...
-
High Country, Incorporated, produces and sells many recreational products. The company has just opened a new plant to produce a folding camp cot that will be marketed throughout the United States....
-
It is possible to investigate the thermo chemical properties of hydrocarbons with molecular modeling methods. (a) Use electronic structure software to predict cHo values for the alkanes methane...
-
Jordan Company uses budgets in controlling costs. The May 2012 budget report for the company??s Packaging Department is as follows. The monthly budget amounts in the report were based on an expected...
-
For the year ended December 31, 2012, the job cost sheets of Heimer Company contained the following data. Other data: 1. Raw materials inventory totaled $15,000 on January 1. During the year,...
-
Information related to Gustavo Company for 2012 is summarized below. Total credit sales $1,100,000 Accounts receivable at December 31 369,000 Bad debts written off 22,150 Instructions (a) What amount...
-
If you are constructing a parallel-plate capacitor, having air and paper as the dielectric medium between the plates, which dielectric material within the plates will make the capacitor act better?...
-
(a) Is the interaction between a charged object and an electrically neutral object always attractive? Why or why not? (b) In Figure 27.4, which type of magnetic pole is induced at the top of each...
-
(a) Draw the elementary magnets inside a bar magnet and a horseshoe magnet, using the half-filled-circle format shown in Figures 27.8 and 27.9. (b) How many poles does the magnetized ring in Figure...
Study smarter with the SolutionInn App