Question: 8.2 Programming ReadMe - Write in Java and include comments The pledge of Allegiance states, I pledge allegiance to the Flag of the United States
8.2 Programming ReadMe - Write in Java and include comments
The pledge of Allegiance states, I pledge allegiance to the Flag of the United States of America, and to the Republic for which it stands: one Nation under God, indivisible, With Liberty and Justice for all. Save the pledge, 174 characters, to a text file. Use the RandomAccessFile class to access the file. Using Seek method, display the characters at positions 124 and 135 only.
Directions
Create a text file with the pledge of allegiance named Pledge.txt using notepad.
Create a reference to the file, Pledge.txt, using the RandomAccessFile class.
Use the Seek method to point at positions 124 and 135, then display the characters represented by the byte streams.
Use try, catch and finally blocks for exception handling.
Grading Rubric
| Task | Points |
| Throws clause added in main method of the ReadMe class | 1 |
| Create a reference of the RandomAccessFile class which points to Pledge.txt | 1 |
| Include try, catch and finally blocks for exception handling | 1 |
| Use the Seek method to point at positions 124 and 135, then display characters represented by the byte streams | 1 |
| Proper documentation | 1 |
| Program works effectively | 1 |
| Total | 6 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
