Lab 12 - Hopefully it works out ok. Best of luck. becomes...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
SUMMARY In this lab you will work on reading from and writing to files and handling exceptions. PRE-LAB You should have done the following things before lab: 1. Complete all previous labs. 2. Read chapter 12 in the book. IN-LAB REVERSE A FILE Create a class called FileModifier. In this class create a method called reverseFile that takes one parameter, a file name. This method should reverse this file. That is, it should reverse the order of the lines in the file, as well as reverse the order of the characters within each line. Note that it should alter the original file, not create a new one. Refer to chapter 12 for help. EXAMPLE The following file: This is a sample file.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Hopefully it works out ok. Best of luck. becomes this after reversing: .kcul fo tseB .ko tuo skrow ti yllufepoH .elif elpmas a si sihT You can create a sample file in DrJava. Just write a few lines of text and save it as SOMETHING.txt. You can also try this out on .java files. GET CREDIT Dont forget to show your TA what youve done before you leave so you get credit for attending and participating in the lab. POST-LAB Be sure you are comfortable reading and writing files as well as handling exceptions. Try some more exercises. What other file manipulations can you perform? Introduction to Computer Science CSI201 Spring 2010 LAB 12...
View Full Document

This note was uploaded on 02/07/2011 for the course CSI 201 taught by Professor Doanne during the Spring '08 term at SUNY Albany.

Ask a homework question - tutors are online