Due: Monday, February 18, 10:00 am
1) (30%) Exercise P19.5 (page 841)
2) (40%) Write a program that prints all the bytes in a file as hexadecimal numbers. Each byte is represented by a two-digit hexadecimal number, followed by a space. Print a line break after 16 bytes. Use the Integer. toString( int i, int radix ) method to convert a number into its hexadecimal String representation.
3) (30%)
a) Test your program from Problem 2 by writing the Java integer 12,346 to a file, and then opening your file in the hexadecimal viewer. The hexadecimal viewer should display: 00 00 30 3A, which is the hexadecimal representation of this number.
b) Determine what the correct hexadecimal representation of the Java string "Hello world!\n" is by looking up the characters in a Unicode table.
c) Turn in a test program that creates a file containing the number given above, and another file containing the string given above, and then calls the proper method of the hex viewer to have it read the files. The test program then prints out the correct hexadecimal representations, so that the user of the program can easily check if the hex viewer was implemented correctly.
Reminders: use proper documentation comments on all classes, methods, and fields. Part 2 of the project is also due.