Name: ____________________________________________________ Alpha: _____________________
Describe help received: _________________________________________________________________
Consider each expression below as appearing at the right here! in file Fruit.java, string that the resulting function call would produce.
|
|
|
foo,
then cat foo | java HW11 will tell you whatever
the program is able to determine about the type of the
file foo.
Your job is to extend it so that in addition to recognizing
ASCII files and JPG files, it also recognizes PDF files (which
begin with four bytes corresponding to the ASCII characters %,
P, D, and F (i.e. bytes %PDF). You may not modify the files
Categorizer.java, RecogASCII.java or RecogJPG.java, but you
may modify HW11.java and you may create new classes.
Remember that casting a char to an int is done like this:
(int)'D'To download HW11.java, Categorizer.java, RecogASCII.java, RecogJPG.java and test filw hwin1-4, make a directory for hw11, cd into it and do: Test your program on the following:
cat hwin1 | java HW11 cat hwin2 | java HW11 cat hwin3 | java HW11 cat hwin4 | java HW11
submit -c=IC211 -p=hw10 *.java