CSE 8B: Introduction to Computer Science: Java (Winter, 2006)

Home | Syllabus | Schedule | Exams | Programming Assignments

Programming Assignment 5

Due Monday, February 20 at 11:59 PM.

Last modified: Wed., Feb 15, 3:50: updated Overview to correctly show no input redirection (<) when calling java Sort.

Previous modifications:

Overview

You'll be writing a program that sorts input lines.

The program will read in a text file and will output another text file which is the original text file with all the lines sorted.

You'll run the program with

java Sort infile outfile

Input/Output

The input could be any text file. The output is a text file (if the file doesn't exist: create it; if it already exists, overwrite it). Your output must match exactly the output we are expecting. I recommend you test your application with:
java Sort  testInput.txt myOutput.txt
diff myOutput.txt testOutput.txt
If diff reports any difference, your output doesn't match. If diff doesn't print anything, that means your output (myOutput.txt) is identical to the provided testOutput.txt.

Requirements

Provided files

All files are in ~/../public/P5.

There are several test inputs and outputs.

Unit Testing

Although I highly suggest you use Test-Driven Development to develop your application, and have a complete set of unit tests, it is not required.

If you do use unit testing, you will probably wanto to use StringInputStream and StringOutputStream to test, rather than the file-based ones.

Hints

Turnin

Create a directory on ieng6 with the following file: To turn in your assignment, cd to that directory and run the command
  bundleP5
and carefully follow the dialog. If it is before the due deadline and all necessary assignment files are present, this will turn in your solution files. You can run bundleP5 more than once if you want; only the last one will count.

Grading

We'll be running your sort program from the command-line with input of our own, and checking the output, which will need to match identically (we'll be doing a diff from the command-line).

The assignment is worth 20 points:

As always, an additional 5% (1 point) is available if you turn the assignment in at least 24 hours early.