a5 - ASSIGNMENT 5 Objects, Files, and More Garage...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ASSIGNMENT 5 Objects, Files, and More Garage Management COMP-202B, Winter 2010, All Sections Due: Wednesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified, you MUST follow all the general instructions and regulations for assignments. Graders have the discretion to deduct up to 10% of the value of this assignment for deviations from the general instructions and regulations. Note that the weight of this assignment in your final grade is equivalent to the combined weight of two of the previous assignments. Also note that the usual lateness policy does NOT not apply to this assignment; instead, late submissions will be accepted with NO penalty until Wednesday, April 21, at 23:55. A lateness penalty of 5% per day late or fraction thereof (including weekends and holidays) will be applied to all submissions sent after 23:55 on Wednesday, April 21, up to a maximum of two full days past this date, after which submissions for this assignment will NOT be accepted and therefore receive a grade of 0. Part 1, Question 1: 0 points Part 2, Question 1: 40 points Part 2, Question 2: 60 points Part 2, Question 3 or 4: 100 points 200 points total Part 1 (0 points): Warm-up Do NOT submit this part, as it will not be graded. However, doing these exercises might help you to do the second part of the assignment, which will be graded. If you have difficulties with the questions of Part 1, then we suggest that you consult the TAs during their office hours; they can help you and work with you through the warm-up questions. Warm-up Question 1 (0 points) Write a Java program which consists of one class called ReverseFile . This class should define one method, main() , which does the following: Ask the user to enter the full paths of two files on disk as String s, and read these paths from the keyboard. Attempt to open the file whose path is given by the first String entered by the user for reading. Attempt to open the file whose path is given by the second String entered by the user for writing. Read the input file line by line and reverse the characters within each line (that is, the String "abcde" should become the String "edcba" ). Also, it should write the reversed lines to the output file, but in the reverse order; that is, the first line in the input file should be the last line in the output file, the second line in the input file should be the second last line in the output file, and so on. 1 Once it has read and reversed all the lines from the input file, and written the reversed lines to the output file in the reverse order, it should close the files. Make sure that the header of your main() method is the following: public static void main(String args) throws IOException The throws IOException clause of the method header will allow your program to compile despite the fact that opening a file for reading or for writing can result in IOException s being thrown....
View Full Document

This note was uploaded on 10/16/2010 for the course COMP 202 taught by Professor Verbrugge during the Winter '07 term at McGill.

Page1 / 8

a5 - ASSIGNMENT 5 Objects, Files, and More Garage...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online