Java Programming - Decorator Design Pattern Create and test three new concrete s
ID: 3831361 • Letter: J
Question
Java Programming - Decorator Design Pattern
Create and test three new concrete subclasses of the OozinozFilter class.
These are the specifications for the NewLineFilter.
A. The NewLineFilter should detect white space, which may be a blank character (a space), a tab, , or a new line, .
B. Whenever a white space character is encountered, the NewLineFilter write() method should insert a new line, , after the preceding text and before the white space which was encountered.
These are the specifications for the PseudoPigLatinFilter.
A. The PseudoPigLatinFilter should detect white space, which may be a blank character (a space), a tab, , or a new line, .
B. Whenever a white space character is encountered, the PseudoPigLatinFilter write() method should insert the string "ay" after the preceding text and before the white space which was encountered.
These are the specifications for the program NewFilterTest.
A. It should contain two strings of your choice, which should each contain at least three occurrences of white space.
B. It should open two files in secondary storage with names of your choice.
C. It should compose (do nested construction) of one of the book's filters and one of your filters and then write out one of the strings to one of the files using the composed filter.
D. It should compose (do nested construction) of another one of the book's filters and your other filter and then write out the other string to the other file.
E. Your work will be evaluated by opening the two output files, examining their contents, and determining whether both the effects of your filters and the book's filters are present in the output.
Explanation / Answer
import java.io.*; public abstract class OozinozFilter extends FilterWriter { protected OozinozFilter(Writer out) { super(out); } public void write(char cbuf[], int offset, int length) throws IOException { for (int i = 0; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.